PHPNews

400 Bad Request

400 Bad Request is the first error code. Every status that starts with a 4 indicates that the client did something wrong. If the status starts with a 5 it means that the server did something wrong. 400 Bad Request is used as a generic error code. It’s a useful default error code if there’s no specific error …

Continue reading »

Written by Evert Pot - - Aggregated on Tuesday November 13, 2018


Which redirect do I choose?

The 3xx status-codes are a bit of a mess. There’s a lot of confusion and mis-use, so I thought it might help to sum all of them up in a single article. Choosing the right redirect Are you responding to a POST request, and instead of returning a status immediately, you want to redirect the user to a confirmat…

Continue reading »

Written by Evert Pot - - Aggregated on Wednesday November 7, 2018


308 Permanent Redirect

308 Permanent Redirect is similar to 301 Moved Permanently . Both indicate that the resource the user tried to access has moved to a new location. In both cases the client should update any bookmarks they had from the old to the new location. Search engines respect these statuses too. The difference between …

Continue reading »

Written by Evert Pot - - Aggregated on Tuesday November 6, 2018


307 Temporary Redirect

307 Temporary Redirect is similar to 302 Found in that it tells a client to temporarily redirect to a different location to access the requested resource. The difference from 302 is that with a 307 , the client must follow the location and issue the exact same request again. So if it did a POST request on …

Continue reading »

Written by Evert Pot - - Aggregated on Tuesday October 30, 2018


306 Switch Proxy

The HTTP specifications, starting from RFC2616 have a gap between the 305 and 307 status codes. The specification states: The 306 status code was defined in a previous version of this specification, is no longer used, and the code is reserved. Naturally I was curious what it used to be, so I …

Continue reading »

Written by Evert Pot - - Aggregated on Tuesday October 23, 2018


305 Use Proxy

305 Use Proxy is a deprecated status code. Using the status-code a server could instruct a client that it should connect to a proxy, and repeat that same request there. 305 kind of works like a redirect. It really tells a client: this resource can only be fetched if you used the right proxy. Presumably a client …

Continue reading »

Written by Evert Pot - - Aggregated on Tuesday October 16, 2018


Ketting 2.3 release

I just released Ketting 2.3 , the missing HATEOAS client for Javascript. I last blogged about this project in June , so I thought it was worth listing the most interesting recent changes. Content-Type and Accept header improvements In the past, the Ketting library used a configurable set of mime-types for …

Continue reading »

Written by Evert Pot - - Aggregated on Thursday October 11, 2018


304 Not Modified

304 Not Modified is used in response to a conditional GET or HEAD request. A request can be made condtional with one of the following headers: If-Match If-None-Match If-Modified-Since If-Unmodified-Since If-Range If-Modified-Since and If-None-Match are used specifically …

Continue reading »

Written by Evert Pot - - Aggregated on Tuesday October 9, 2018


Http errors package for Typescript

Hacktoberfest 5 has begon, and as my first contribution I wanted to make a tiny Typescript library with HTTP errors. Whenever I start a new Javascript-based project, whether that’s on the server, or if I’m writing an API client with Fetch , I often find myself doing the same thing over and over again, which is to …

Continue reading »

Written by Evert Pot - - Aggregated on Wednesday October 3, 2018


303 See Other

303 See Other can be used to tell a client that the result of the operation can be found on another location. For example, if a client did a POST request, a server might immediately respond to that POST request with a response body, for example to inform the client or user that the operation was successful. …

Continue reading »

Written by Evert Pot - - Aggregated on Tuesday October 2, 2018


302 Found

302 Found is another misunderstood status code. The intent of this status is to tell the client that the resource they tried to access is temporarily hosted somewhere else. Because the change is temporary, the client shouldn’t update its own links to the new location but keep hitting the endpoint that sent the …

Continue reading »

Written by Evert Pot - - Aggregated on Tuesday September 25, 2018


301 Moved Permanently

301 Moved Permanently tells a client that the resource they’re trying to access has moved to a new location. The server will include the new location in the Location header. When a client sees this response, it should repeat the same request on the new location, and if it can, it should also update any links it …

Continue reading »

Written by Evert Pot - - Aggregated on Tuesday September 18, 2018


300 Multiple Choices

300 Multiple Choices is the first of the 3xx series, which are all used for redirection. 300 should be emitted specifically when a resource can redirect to more than one location, and it wants the user to decide which one. Support for 300 is scarce. In the past both the URI and Alternates HTTP …

Continue reading »

Written by Evert Pot - - Aggregated on Tuesday September 11, 2018


Curveball - a TypeScript micro-framework

I’ve been doing Node.js development for a little while, and I wanted to try my hand at writing a framework. It’s probably a rite of passage to do this, although it’s not really my first. By releasing it today, I want to see if this is worth investing time in in the future, or if I should focus my energy elsewhere. …

Continue reading »

Written by Evert Pot - - Aggregated on Thursday September 6, 2018


226 IM Used

226 IM Used is used by a specific extension of the HTTP protocol. The extension allows a HTTP server to send diffs (changes) of resources to clients. For example, a client (like a browser) might have a cache for a certain resource. It also has an ETag stored. When a client wants to see if there’s an update, it …

Continue reading »

Written by Evert Pot - - Aggregated on Tuesday September 4, 2018


HTTP/2 Push for APIs

HTTP/2 brought us the ability to push resources from server to client, before client knows they need it. HTTP/2 push has had mixed success, up to a point where Chrome developers are thinking of experimenting with disabling it alltogether . I think this would be a huge loss for APIs, so I shared my thoughts on the …

Continue reading »

Written by Evert Pot - - Aggregated on Saturday September 1, 2018


Use 'let' and 'const' instead of 'var'

If you are writing javascript code for Node.js, Babel, Typescript or if you can target up-to-date browsers , chances are that your environment supports the let and const keywords. If this is the case, you should stop using var and use let and const exclusively. Here’s why: var uses something …

Continue reading »

Written by Evert Pot - - Aggregated on Wednesday August 29, 2018


208 Already Reported

208 Already Reported is, like 207 Multi-Status a HTTP status code specific to WebDAV. It’s even more obscure, because it’s defined in a rarely used extension of WebDAV . The extension adds ‘Binding’ extensions to WebDAV. WebDAV is a bit like a filesystem over HTTP, and the Binding extensions add support for a …

Continue reading »

Written by Evert Pot - - Aggregated on Tuesday August 28, 2018


Building protocols with HTTP

Mark Nottingham is working on a great guide titled “Building Protocols with HTTP”. Regardless of if you are doing pure REST or some variant, this guide has an absolute wealth of information that everyone should read at least once before building something on top of HTTP. It’s matter-of-fact, concise and …

Continue reading »

Written by Evert Pot - - Aggregated on Wednesday August 22, 2018