PHPNews

407 Proxy Authentication Required

407 Proxy Authentication Required is an error a HTTP proxy returns if it requires authentication. It’s really similar to 401 Unauthorized . Example HTTP/1.1 407 Proxy Authentication Required Proxy-Authenticate: Basic; realm="Secured area" As you can see above, the response looks pretty similar to 401 …

Continue reading »

Written by Evert Pot - - Aggregated on Tuesday January 15, 2019


MySQL examples in Node.js

If you’re integrating your Node.js service with MySQL, you probably want to execute queries. I’ve seen a fair bit of ugly code to do this, often using callbacks. I thought I would share some of my own patterns here. Maybe this is useful to others to read. I don’t typically use ORM’s. If you’re already happy with …

Continue reading »

Written by Evert Pot - - Aggregated on Wednesday January 9, 2019


406 Not Acceptable

Happy 2019! After a small hiatus we’re back with this captivating series. I hope you’re as excited as I am and I hope you have the best 2019! 406 Not Acceptable is emitted by a server when the client asked for a specific representation of a resource that the server doesn’t support. Accept headers HTTP has …

Continue reading »

Written by Evert Pot - - Aggregated on Tuesday January 8, 2019


One year in San Francisco as a Software Engineer

In 2017 the company I worked for in Toronto got acquired by Yelp. The software engineers in my company (including myself) were asked to move to San Francisco. At the end of 2017 we moved, and I spent most of 2018 there. With the year coming to an end, I thought it might be a good time to reflect on my time there. …

Continue reading »

Written by Evert Pot - - Aggregated on Thursday January 3, 2019


405 Method Not Allowed

405 Method Not Allowed should be returned by a server when a certain HTTP method is not supported at a resource. It’s a bit different from 403 Forbidden . 403 suggest that the server might support the HTTP request, but the client doesn’t have the right privileges to do the HTTP request. 405 Method Not …

Continue reading »

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


404 Not Found

404 Not Found hardly needs an introduction. It’s by far the most seen status by developers and non-developers alike. 404 is emitted when a resource doesn’t exist, never existed or if the server doesn’t want a client to know that a resource exist. If the server knows the resource doesn’t and will never exist …

Continue reading »

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


Floats and money

A very common and oft-repeated programmer’s wisdom is “Don’t use floats for currency”. This always made a lot of sense to me. The idea is that floats are imprecise, due to the way they are stored. Effectively floats are stored not by just their digits, but by a formula . This formula can’t accurately represent …

Continue reading »

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


403 Forbidden

403 Forbidden should be used when a client is trying to do a request it’s not allowed to do for a variety of reasons. Maybe the user doesn’t have the right permissions, or maybe it’s logged in with the wrong credentials. It’s a good generic status code for anything that’s “not allowed” for a variety of reasons, …

Continue reading »

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


I made a thing: csv-1-2-3

My current job involves a lot of spreadsheets and financial data. Like my last few jobs, I’m still mainly building REST API’s, but some of them now use text/csv and Link: headers instead of HAL! Anyway, I had trouble finding a simple CLI-based tool to browser .csv files, and was reminded of an MS-DOS …

Continue reading »

Written by Evert Pot - - Aggregated on Sunday December 2, 2018


402 Payment Required

402 Payment Required is a status-code described by the standard as: The 402 (Payment Required) status code is reserved for future use. The original idea may have been that commercial websites and APIs would want to have a default way to communicate that a HTTP request can be repeated, after a user paid …

Continue reading »

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


401 Unauthorized

When a client makes a HTTP request, but the server requires the request to be authenticated a 401 Unauthorized status is returned. This could mean that a user needs to log in first, or more generally that authentication credentials are required. It could also mean that the provided credentials were incorrect. …

Continue reading »

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


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