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

Content Negotiation - Offered and Accepted #75

Closed
jeevatkm opened this issue Jun 27, 2017 · 2 comments
Closed

Content Negotiation - Offered and Accepted #75

jeevatkm opened this issue Jun 27, 2017 · 2 comments
Assignees
Labels
Projects

Comments

@jeevatkm
Copy link
Member

jeevatkm commented Jun 27, 2017

Content Negotiation

Content negotiation is used to validate what is being offered and accepted by server in-terms of request and response. (also known as Content-Type restriction)

Offered - Accept HTTP header RFC2616

The resource identified by the request is only capable of generating
response entities which have content characteristics not acceptable
according to the accept headers sent in the request.

For example: Client sends Accept header as application/xml. However server only supports serving JSON i.e. application/json. Then server responds with 406 Not Acceptable.

Accepted - Content-Type HTTP header RFC2616

The server is refusing to service the request because the entity of
the request is in a format not supported by the requested resource
for the requested method.

For example: Client sends Content-Type header as application/xml. However server only supports JSON payload as request body. Then server responds with 415 Unsupported Media Type.

Configuration

# aah provides `Content Negotiation` feature for the incoming HTTP request.
  # Read more about implementation and RFC details here Github #75.
  # Perfect for REST API, also can be used for web application too if needed.
  content_negotiation {
    # To enable Content Negotiation for the application.
    # Default value is `false`.
    #enable = true

    # For example: Client sends Accept header as `application/xml`.
    # However server only supports serving JSON i.e. `application/json`.
    # Then server responds with 406 Not Acceptable.
    # Default value is empty list and disabled.
    #offered = ["application/json", "text/json"]

    # For example: Client sends Content-Type header as `application/xml`.
    # However server only supports JSON payload as request body.
    # Then server responds with 415 Unsupported Media Type.
    # Default value is empty list and disabled.
    #accepted = ["application/json", "text/json"]
  }
@jeevatkm jeevatkm created this issue from a note in aah Roadmap (Backlog) Jun 27, 2017
@jeevatkm jeevatkm changed the title Provide a way to limit request content-type and request body size Config Options to limit request content-type and request body size Jul 8, 2017
@jeevatkm jeevatkm changed the title Config Options to limit request content-type and request body size Content Negotiation and Request Body Size Limit Jul 26, 2017
@jeevatkm jeevatkm self-assigned this Jul 26, 2017
@jeevatkm jeevatkm changed the title Content Negotiation and Request Body Size Limit Content Negotiation - Offered and Accepted Jul 26, 2017
@jeevatkm jeevatkm moved this from Backlog to v0.8 Iteration (Not started) in aah Roadmap Jul 29, 2017
@jeevatkm jeevatkm modified the milestone: v0.8 Milestone Aug 1, 2017
@jeevatkm jeevatkm moved this from v0.8 Iteration to v0.8 - In Progress in aah Roadmap Aug 4, 2017
@jeevatkm
Copy link
Member Author

jeevatkm commented Aug 5, 2017

Also known as Content-Type restriction.

@jeevatkm
Copy link
Member Author

jeevatkm commented Aug 7, 2017

Merged :)

@jeevatkm jeevatkm closed this as completed Aug 7, 2017
@jeevatkm jeevatkm moved this from v0.8 - In Progress to Done in aah Roadmap Aug 7, 2017
jeevatkm added a commit to go-aah/docs that referenced this issue Aug 8, 2017
@jeevatkm jeevatkm moved this from Released to Audience to v0.8 - Completed in aah Roadmap Aug 10, 2017
@jeevatkm jeevatkm moved this from v0.8 - Completed to Released to Audience in aah Roadmap Sep 3, 2017
jeevatkm added a commit to go-aah/app-templates that referenced this issue Jul 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
aah Roadmap
  
Released to Audience
Development

No branches or pull requests

1 participant