204 Http Error
Contents |
response. 10.1 Informational 1xx This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line. There are no required headers for this class of status code. Since HTTP/1.0 did http status 500 not define any 1xx status codes, servers MUST NOT send a 1xx response to an
Http Error 304
HTTP/1.0 client except under experimental conditions. A client MUST be prepared to accept one or more 1xx status responses prior to a regular http error codes response, even if the client does not expect a 100 (Continue) status message. Unexpected 1xx status responses MAY be ignored by a user agent. Proxies MUST forward 1xx responses, unless the connection between the proxy and its client http error 204 no content has been closed, or unless the proxy itself requested the generation of the 1xx response. (For example, if a proxy adds a "Expect: 100-continue" field when it forwards a request, then it need not forward the corresponding 100 (Continue) response(s).) 10.1.1 100 Continue The client SHOULD continue with its request. This interim response is used to inform the client that the initial part of the request has been received and has not yet been rejected by the
Http Error 203
server. The client SHOULD continue by sending the remainder of the request or, if the request has already been completed, ignore this response. The server MUST send a final response after the request has been completed. See section 8.2.3 for detailed discussion of the use and handling of this status code. 10.1.2 101 Switching Protocols The server understands and is willing to comply with the client's request, via the Upgrade message header field (section 14.42), for a change in the application protocol being used on this connection. The server will switch protocols to those defined by the response's Upgrade header field immediately after the empty line which terminates the 101 response. The protocol SHOULD be switched only when it is advantageous to do so. For example, switching to a newer version of HTTP is advantageous over older versions, and switching to a real-time, synchronous protocol might be advantageous when delivering resources that use such features. 10.2 Successful 2xx This class of status code indicates that the client's request was successfully received, understood, and accepted. 10.2.1 200 OK The request has succeeded. The information returned with the response is dependent on the method used in the request, for example: GET an entity corresponding to the requested resource is sent in the response; HEAD the entity-header fields corresponding to the requested resource are sent in the response without any message-body;
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads http error 206 with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack http error 402 Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign
Http Error 506
up HTTP Get with 204 No Content: Is that normal up vote 14 down vote favorite 2 Is it a normal occurrence for an HTTP GET Request to have a response with status code 204 - No Content? Like, is this https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html semantically correct with respect to what an HTTP GET is supposed to accomplish? I know that a 204 - No Content is okay for an HTTP POST Request. For GET request, if no data is to be sent back, is the 204 status code appropriate? Should I use 404, or just stick to 200 for success but have an empty response? The use case for this question is a Java application that I am writing for Google App Engine. I am sending a http://stackoverflow.com/questions/12807753/http-get-with-204-no-content-is-that-normal request to a servlet, but the data to be sent back to the client will be transmitted through a Channel API socket instead of in the HTTP Response. Currently, my client sends a POST with no content in the request body, and waits for a 204 response back from the servlet before polling the Channel API socket. Because no data I being sent in the body of the request, I am debating whether it makes more sense for me to send a GET instead of a POST. google-app-engine http get http-status-codes channel-api share|improve this question edited Sep 15 '14 at 14:17 Tshepang 4,6731058102 asked Oct 9 '12 at 20:16 ecbrodie 3,47983677 add a comment| 2 Answers 2 active oldest votes up vote 28 down vote accepted 204 No Content The server has fulfilled the request but does not need to return an entity-body, and might want to return updated metainformation. The response MAY include new or updated metainformation in the form of entity-headers, which if present SHOULD be associated with the requested variant. According to the RFC part for the status code 204, it seems to me a valid choice for a GET request. A 404 Not Found, 200 OK with empty body and 204 No Content have completely different meaning, sometimes we can't use proper status code but bend the rules and they will come back to bite you one day or later. So, if you can use proper status code, use it! I think the
building non-trivial REST APIs. In order to be as supportive of the client as possible, a REST API should not return 204 (No Content) responses. From the service's perspective, a 204 (No Content) response may be a perfectly valid response to http://blog.ploeh.dk/2013/04/30/rest-lesson-learned-avoid-204-responses/ a POST, PUT or DELETE request. Particularly, for a DELETE request it seems very appropriate, because https://github.com/apiaryio/dredd/issues/196 what else can you say? However, from the perspective of a proper HATEOAS-aware client, a 204 response is problematic because there are no links to follow. When hypermedia acts as the engine of application state, when there are no links, there's no state. In other words, a 204 response throws away all application state. If a client encounters a 204 response, it can either give http error up, go to the entry point of the API, or go back to the previous resource it visited. Neither option is particularly good. Giving up is not a good option if there's still work to do. Essentially, this is equivalent to a crashing client. Going to the entry point of the API may allow the client to move on, doing what it was doing, but state may still be lost. Going back (the equivalent of using your browser's back button) 204 http error may be the best option, but has a couple of problems: First, if the client just did a DELETE, the previous resource in the history may now be gone (it was just deleted). The client would have to go back twice to arrive at a proper resource. Second, while your browser has built-in history, a programmatic HTTP client probably hasn't. You could add that feature to your client, but it would require more work. Once more, it would require the client to maintain state, which means that you'd be moving state from hypermedia to the client. It's just not a HATEOAS-compliant approach. A good REST API should make it easy to be a client. While this is only a variation of Postel's law, I also like to think of this in terms or courtesy. The service has a lot of information available to it, so it might as well be courteous and help the client by sharing appropriate pieces of information. Instead of a 204 (No Content) response, tell the client what it can do now. Responding to POST requests An HTTP POST request often represents some sort of Command - that is: an intent to produce side effects. If the service handles the request synchronously, it should return the result of invoking the Command. A common POST action is to create a new resource. At the very least, the REST API should return a 201 (Created) with a
Support Search GitHub This repository Watch 58 Star 1,161 Fork 106 apiaryio/dredd Code Issues 157 Pull requests 7 Projects 0 Pulse Graphs New issue 204 No Content should throw error when body is sent instead of parsing it #196 Open neonichu opened this Issue May 21, 2015 · 9 comments Projects None yet Labels bug Milestone No milestone Assignees No one assigned 5 participants neonichu commented May 21, 2015 If a 204 HTTP response contains a content-type header, dredd tries to parse the empty response and fails, thus breaking the test. As 204 response must not have a body, this doesn't seem like a good behaviour. Blueprint: ### Delete a Webhook [DELETE] + Request + Headers Authorization: Bearer b4c0n73n7fu1 + Response 204 (application/vnd.contentful.management.v1+json) Dredd output: fail: DELETE /spaces/5smsq22uwt4m/webhook_definitions/yolo duration: 673ms fail: headers: At '/content-type' Missing required property: content-type body: Expected body: Content-Type is application/vnd.contentful.management.v1+json but body is not a parseable JSON: Parse error on line 1: ^ Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'EOF' body: No validator found for real data media type 'text/plain' and expected data media type 'null'. request: body: headers: Authorization: Bearer XXX User-Agent: Dredd/0.5.2 (Darwin 14.4.0; x64) uri: /spaces/5smsq22uwt4m/webhook_definitions/yolo method: DELETE expected: headers: Content-Type: application/vnd.contentful.management.v1+json body: statusCode: 204 actual: statusCode: 204 headers: accept-ranges: bytes access-control-allow-headers: Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentf