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

Sending a MultipartPayload always does a POST #11

Closed
kevinrenskers opened this issue Jun 19, 2019 · 5 comments
Closed

Sending a MultipartPayload always does a POST #11

kevinrenskers opened this issue Jun 19, 2019 · 5 comments

Comments

@kevinrenskers
Copy link

kevinrenskers commented Jun 19, 2019

It's currently not possible to send a MultipartPayload request via PUT or PATCH, it always overrides it to a POST request. Is this expected, or a bug?

@MihaelIsaev
Copy link
Member

It's definitely a bug! I've just fixed it in v.1.11.1, thanks!

@kevinrenskers
Copy link
Author

Great, thanks! Looking forward to a new version on Cocoapods :)

@MihaelIsaev
Copy link
Member

@kevinrenskers yeah, just uploaded it, you could update now 🙂

@kevinrenskers
Copy link
Author

Hm I updated to 1.11.1, but it's still sending my request via POST.

func updateUser(_ payload: EditUserData) -> APIRequest<User> {
  return APIRequest("user/", payload: serverPayload).method(.put)
}

(where EditUserData is a MultipartPayload struct)

🌸 [CodyFire]: PUT to http://minotaur.local:8000/api/user/
🌸 [CodyFire]: Response: 405 on PUT to http://minotaur.local:8000/api/user/
🌸 [CodyFire]: Error: PUT user/ methodNotAllowed

status: methodNotAllowed
method: put
endpoint: user/
headers: ["Authorization": "Bearer xyz"]
httpBody:{"detail":"Method \"POST\" not allowed."}
json: ["detail": Method "POST" not allowed.]

So the logs seem to indicate that it thinks it's sending via PUT, but the actual http method is actually a POST. Confirmed via Charles proxy.

@kevinrenskers
Copy link
Author

Never mind, clean build solves the problem :)

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

2 participants