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

Non-GET requests always get the request data added to the body #30

Open
maximiliansoelch opened this issue Nov 17, 2023 · 0 comments
Open

Comments

@maximiliansoelch
Copy link
Member

For all non-get request we currently add the request data to the body automatically:

// NOTE: GET requests with body are never sent
// thus, add body only for non-GET requests
if request.method != .get {
urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")
urlRequest.httpBody = body(for: request)
}
printRequest(urlRequest: urlRequest)

This can lead to issues, e.g. when a POST Endpoint called via APIClient does not expect a body (only as optional): ls1intum/Artemis#7610

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

No branches or pull requests

1 participant