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

Admin requests fail when content type includes a charset #350

Closed
paulroub opened this issue Sep 30, 2019 · 3 comments
Closed

Admin requests fail when content type includes a charset #350

paulroub opened this issue Sep 30, 2019 · 3 comments
Assignees
Labels

Comments

@paulroub
Copy link

When POSTing a mapping request from C#, by default a "charset=utf-8" parameter is added to the Content-Type header. This causes the request to fail with

{"Status":"No matching mapping found"}

Remove the charset and the request succeeds.

Easily reproducible with curl. This succeeds:

URL=http:https://localhost:9091/__admin/mappings

JSON='{
    "request": {
        "method": "GET",
        "url": "/some/thing"
    },
    "response": {
        "status": 200,
        "body": "Hello world!",
        "headers": {
            "Content-Type": "text/plain"
        }
    }
}'

curl \
    -H "Content-Type: application/json" \
    -d "$JSON" \
    -iv \
    "$URL"

whereas this fails:

URL=http:https://localhost:9091/__admin/mappings

JSON='{
    "request": {
        "method": "GET",
        "url": "/some/thing"
    },
    "response": {
        "status": 200,
        "body": "Hello world!",
        "headers": {
            "Content-Type": "text/plain"
        }
    }
}'

curl \
    -H "Content-Type: application/json; charset=utf-8" \
    -d "$JSON" \
    -iv \
    "$URL"
@StefH StefH added the bug label Sep 30, 2019
@StefH StefH self-assigned this Sep 30, 2019
StefH added a commit that referenced this issue Sep 30, 2019
@StefH
Copy link
Collaborator

StefH commented Oct 2, 2019

You can try MyGet version:
WireMock.Net.1.0.32-ci-11942.nupkg

@StefH
Copy link
Collaborator

StefH commented Oct 5, 2019

@paulroub did you have time to test?

@paulroub
Copy link
Author

paulroub commented Oct 5, 2019 via email

@StefH StefH closed this as completed Oct 5, 2019
StefH added a commit that referenced this issue Oct 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants