Skip to content

[WORKING] Method: PATCH, Both v1 and v2 Controller has consumes=application/merge-patch+json #1

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: master
Choose a base branch
from

Conversation

BlackRider97
Copy link
Owner

Issue dotnet#744

Changed Dot Net core version to test it better

@BlackRider97
Copy link
Owner Author

BlackRider97 commented Jun 25, 2021

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:28: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-25T18:58:25.7349979+05:30","customer":"Bob Smith"}

Case-2 Incorrect content type
Expected status code: 415 Unsupported Media Type
Found status code: 415 Unsupported Media Type

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 415 Unsupported Media Type
< Date: Fri, 25 Jun 2021 13:47:49 GMT
< Server: Kestrel
< Content-Length: 0
<
* Connection #0 to host localhost left intact

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