Treat HTTP status codes as strings » комментарииhttps://softwaremaniacs.org/blog/2017/05/13/http-status-codes-strings/2018-08-11T13:30:58.779169-07:00Иван Сагалаев о программировании и веб-разработкеhttp://softwaremaniacs.org/media/sm_org/style/photo.jpgEugene на "Treat HTTP status codes as strings"
2018-08-11T13:30:58.779169-07:00Eugenehttps://softwaremaniacs.org/blog/2017/05/13/http-status-codes-strings/#comment-494529About 451. Maybe it's worth thinking about this like "you let your government do this stupid shit, so you screwed up".
<p>About 451. Maybe it's worth thinking about this like "you let your government do this stupid shit, so you screwed up".jyax на "Treat HTTP status codes as strings"
2017-05-14T10:22:33.103750-07:00jyaxhttps://softwaremaniacs.org/blog/2017/05/13/http-status-codes-strings/#comment-494482451 is up to the user to fix, not the server...
<p>451 is up to the user to fix, not the server...Sergey на "Treat HTTP status codes as strings"
2017-05-13T14:04:22.467002-07:00Sergeyhttps://softwaremaniacs.org/blog/2017/05/13/http-status-codes-strings/#comment-494481When treated as ints, checking for the error class looks a bit better: if (status / 100 == 2)
<p>When treated as ints, checking for the error class looks a bit better:</p>
<pre><code>if (status / 100 == 2)
</code></pre>Alexey на "Treat HTTP status codes as strings"
2017-05-13T11:59:56-07:00Alexeyhttps://softwaremaniacs.org/blog/2017/05/13/http-status-codes-strings/#comment-494480Probably not much better, but still: if status // 100 == 2: In JS: if (Math.floor(status / 100) == 2) Nitpick: why is 451 "you screwed up"? It's more like "your government screwed up".
<p>Probably not much better, but still:</p>
<pre><code>if status // 100 == 2:
</code></pre>
<p>In JS:</p>
<pre><code>if (Math.floor(status / 100) == 2)
</code></pre>
<p>Nitpick: why is 451 "you screwed up"? It's more like "your government screwed up".