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

Set Content-* Headers Within List Representation #7

Closed
fr33r opened this issue Apr 7, 2020 · 0 comments
Closed

Set Content-* Headers Within List Representation #7

fr33r opened this issue Apr 7, 2020 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@fr33r
Copy link
Collaborator

fr33r commented Apr 7, 2020

Description

When receiving the list representation in the response of a 406 Not Acceptable response during proactive negotiation, or in a response during reactive negotiation, the Content-* headers are not set appropriately.

Steps to Reproduce

  1. Issue a request for an unsupported content type during proactive negotiation OR issue a request using reactive negotiation.

Expected Behavior

The following headers should be set appropriately:

  • Content-Charset
  • Content-Encoding
  • Content-Language

Actual Behavior

freer > curl -K get_account.curl 127.0.0.1:8000/accounts/ea8123f6-f42c-4c3a-9a19-987229b42780 | jq .
HTTP/1.1 406 Not Acceptable
Content-Charset: 
Content-Encoding: 
Content-Language: 
Content-Length: 824
Content-Type: application/json
Date: Tue, 07 Apr 2020 05:11:15 GMT
{
  "representations": [
    {
      "contentType": "application/json",
      "contentLanguage": "en-US",
      "contentEncoding": [
        "identity"
      ],
      "contentLocation": "/accounts/ea8123f6-f42c-4c3a-9a19-987229b42780",
      "contentCharset": "ascii",
      "sourceQuality": 0
    },
    {
      "contentType": "application/yaml",
      "contentLanguage": "en-US",
      "contentEncoding": [
        "identity"
      ],
      "contentLocation": "/accounts/ea8123f6-f42c-4c3a-9a19-987229b42780",
      "contentCharset": "ascii",
      "sourceQuality": 0
    },
    {
      "contentType": "application/xml",
      "contentLanguage": "en-US",
      "contentEncoding": [
        "identity"
      ],
      "contentLocation": "/accounts/ea8123f6-f42c-4c3a-9a19-987229b42780",
      "contentCharset": "ascii",
      "sourceQuality": 0
    },
    {
      "contentType": "application/json",
      "contentLanguage": "en-US",
      "contentEncoding": [
        "gzip"
      ],
      "contentLocation": "/accounts/ea8123f6-f42c-4c3a-9a19-987229b42780",
      "contentCharset": "ascii",
      "sourceQuality": 0
    }
  ]
}

Versions

  • go version go1.12.9 linux/amd64
  • github.com/freerware/negotiator v0.1.0
@fr33r fr33r added the bug Something isn't working label Apr 7, 2020
@fr33r fr33r self-assigned this Apr 7, 2020
@fr33r fr33r closed this as completed Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant