Skip to content

[NOT WORKING AT ALL] Method: PATCH, V2 controller having application/json and V1 controller having application/merge-patch+json #2

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

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

Conversation

BlackRider97
Copy link
Owner

@BlackRider97 BlackRider97 commented Jun 25, 2021

This is on top of #1

Issue microsoft#744

…json and another V1 controller having application/merge-patch+json
@BlackRider97
Copy link
Owner Author

BlackRider97 commented Jun 25, 2021

Case-1 Correct content type
Expected status code: 201
Found status code: 405 Method Not Allowed

curl -X PATCH "http://localhost:5000/api/orders/42?api-version=1.0" -d '{"customer":"Bob Smith"}' -H "Content-Type: application/merge-patch+json" -v
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 5000 (#0)
> PATCH /api/orders/42?api-version=1.0 HTTP/1.1
> Host: localhost:5000
> User-Agent: curl/7.58.0
> Accept: */*
> Content-Type: application/merge-patch+json
> Content-Length: 24
>
* upload completely sent off: 24 out of 24 bytes
< HTTP/1.1 405 Method Not Allowed
< Date: Fri, 25 Jun 2021 13:53:15 GMT
< Content-Type: application/json; charset=utf-8
< Server: Kestrel
< Transfer-Encoding: chunked
< Allow: PATCH
< api-supported-versions: 1.0, 2.0, 3.0
< api-deprecated-versions: 0.9
<
* Connection #0 to host localhost left intact
{"error":{"code":"UnsupportedApiVersion","message":"The HTTP resource that matches the request URI 'http://localhost:5000/api/orders/42' with API version '1.0' does not support HTTP method 'PATCH'.","innerError":null}}

Case-2 Incorrect content type
Expected status code: 415 Unsupported Media Type
Found status code: 405 Method Not Allowed

curl -X PATCH "http://localhost:5000/api/orders/42?api-version=1.0" -d '{"customer":"Bob Smith"}' -H "Content-Type: application/json" -v
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 5000 (#0)
> PATCH /api/orders/42?api-version=1.0 HTTP/1.1
> Host: localhost:5000
> User-Agent: curl/7.58.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 24
>
* upload completely sent off: 24 out of 24 bytes
< HTTP/1.1 405 Method Not Allowed
< Date: Fri, 25 Jun 2021 13:55:00 GMT
< Content-Type: application/json; charset=utf-8
< Server: Kestrel
< Transfer-Encoding: chunked
< Allow: PATCH
< api-supported-versions: 1.0, 2.0, 3.0
< api-deprecated-versions: 0.9
<
* Connection #0 to host localhost left intact
{"error":{"code":"UnsupportedApiVersion","message":"The HTTP resource that matches the request URI 'http://localhost:5000/api/orders/42' with API version '1.0' does not support HTTP method 'PATCH'.","innerError":null}}

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