Code Monkey home page Code Monkey logo

negotiator's People

Contributors

fr33r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

negotiator's Issues

SourceQuality Not Set in List Representation

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 sourceQuality is always 0.

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 sourceQuality property should be set correctly.

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

Set Content-* Headers Within List Representation

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.