gitlab icon indicating copy to clipboard operation
gitlab copied to clipboard

Add body_as_json configuration parameter

Open seanmil opened this issue 9 months ago • 1 comments

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 avatar Mar 21 '25 14:03 seanmil

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)

seanmil avatar Mar 21 '25 15:03 seanmil

Thank you!

NARKOZ avatar Jun 18 '25 20:06 NARKOZ

Released in version 6.0.0 https://github.com/NARKOZ/gitlab/releases/tag/v6.0.0

NARKOZ avatar Jun 28 '25 11:06 NARKOZ