Skip to content

[NOT WORKING Partially] Method: PATCH, V2 controller does not have consumes attribute and V1 controller having application/merge-patch+json #3

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 2 commits 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

Rajneesh Mitharwal added 2 commits June 25, 2021 19:06
…json and another V1 controller having application/merge-patch+json
…[consumes] and V1 controller having application/merge-patch+json
@BlackRider97 BlackRider97 changed the title [NOT WORKING Partially ] Method: PATCH, V2 controller does not have consumes attribute and V1 controller having application/merge-patch+json [NOT WORKING Partially] Method: PATCH, V2 controller does not have consumes attribute and V1 controller having application/merge-patch+json Jun 25, 2021
@BlackRider97
Copy link
Owner Author

Case-1 Correct content type
Expected status code: 201
Found status code: 201

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 201 Created
< Date: Fri, 25 Jun 2021 13:32:25 GMT
< Content-Type: application/json; charset=utf-8
< Server: Kestrel
< Transfer-Encoding: chunked
< Location: http://localhost:5000/api/Orders/1
< api-supported-versions: 1.0, 2.0, 3.0
< api-deprecated-versions: 0.9
<
* Connection #0 to host localhost left intact
{"id":1,"createdDate":"2021-06-25T19:02:25.7297646+05:30","customer":"Bob Smith"}

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
$ 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:32:12 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