question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Guidance about `Accept` header for servers

See original GitHub issue

The protocol test RestJsonNoInputAllowsAccept caught my eye.

  1. Where in the Smithy spec is it specified how servers should handle this header?
  2. Should restJson1 servers reject requests if they don’t have Content-Type set and the Accept header is not set to any of these values?
  3. Should servers accept requests that don’t specify Content-Type nor Accept, but whose body is empty?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
david-perezcommented, Jan 14, 2022

@adamthom-amzn Sounds good. That is in fact the same S3-like use case that a user of our sSDK wants to build: https://github.com/awslabs/smithy-rs/pull/1023#discussion_r777568429

But they’re using restXml, which currently also says that Content-Type MUST be application/octet-stream in the case of blob. Shall we change that too?

1reaction
adamthom-amzncommented, Jan 13, 2022

I’m proposing we change the spec for blob to say the Content-Type can be anything, and handling of the content is delegated to the server implementation. Does this work for you?

My mental model is this: if I wanted to have a REST API for a content repository that could receive images or videos of many different formats, Content-Type is the natural way to convey that. application/octet-stream discards important data in this use-case, and blob would be the appropriate member choice.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Accept - HTTP - MDN Web Docs
The Accept request HTTP header indicates which content types, expressed as MIME types, the client is able to understand. The server uses ...
Read more >
HTTP/1.1: Header Field Definitions
The Accept request-header field can be used to specify certain media types which are acceptable for the response. Accept headers can be used...
Read more >
HTTP headers | Accept - GeeksforGeeks
The Accept header is used to inform the server by the client that which content type is understandable by the client expressed as...
Read more >
Accept-Ranges - HTTP: The Definitive Guide [Book] - O'Reilly
Name Accept-Ranges Synopsis The Accept-Ranges header differs from the other Accept headers—it is a response header used by servers to tell clients whether ......
Read more >
Accept Header Field - Software AG Documentation
The Accept header field specifies which content type or types the client will accept in the response. The Accept header field can specify...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found