Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add body_as_json configuration parameter #712

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

seanmil
Copy link

@seanmil seanmil commented Mar 21, 2025

Allow the user to configure the client to use a Content-Type of application/json for all requests with a body unless the request explicitly provides its own Content-Type header.

Using application/json provides a broader range of compatibility with the GitLab API, especially for calls where the body expects more complex data structures.

This defaults to false for backwards compatibility.

Allow the user to configure the client to use
a Content-Type of application/json for all requests
with a body unless the request explicitly provides
its own Content-Type header.

Using application/json provides a broader range
of compatibility with the GitLab API, especially
for calls where the body expects more complex
data structures.

This defaults to false for backwards compatibility.
@seanmil
Copy link
Author

seanmil commented Mar 21, 2025

Note that I believe always using application/json by default would be a good change for the next non-backwards-compatible release. I don't believe any part of the GitLab API cannot accept JSON bodies (excepting file uploads requiring multipart form-data, such as https://docs.gitlab.com/api/secure_files/#create-secure-file)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant