<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Http on Brian Faust</title><link>https://vacua.dev/tags/http/</link><description>Recent content in Http on Brian Faust</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Mon, 01 Jan 0001 00:00:00 +0000</lastBuildDate><atom:link href="https://vacua.dev/tags/http/rss.xml" rel="self" type="application/rss+xml"/><item><title>An HTTP 200 Does Not Mean the Operation Succeeded</title><link>https://vacua.dev/thoughts/an-http-200-does-not-mean-the-operation-succeeded/</link><pubDate>Mon, 01 Jan 2018 00:00:00 +0000</pubDate><guid>https://vacua.dev/thoughts/an-http-200-does-not-mean-the-operation-succeeded/</guid><description>&lt;p&gt;Two requests reach the same JSON application.&lt;/p&gt;
&lt;p&gt;The first lacks authentication. The server returns HTTP 200 with this body:&lt;/p&gt;
&lt;figure class="code-figure"&gt;
 &lt;div class="code-block" data-copy-code&gt;
 &lt;button class="copy-code" type="button" aria-label="Copy code"&gt;copy&lt;/button&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-json" data-lang="json"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;status&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;error&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;code&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;401&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;message&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;Unauthenticated&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
 &lt;/div&gt;
&lt;/figure&gt;
&lt;p&gt;The second is authenticated but lacks permission to browse a collection. It
also returns HTTP 200, this time with an empty array:&lt;/p&gt;
&lt;figure class="code-figure"&gt;
 &lt;div class="code-block" data-copy-code&gt;
 &lt;button class="copy-code" type="button" aria-label="Copy code"&gt;copy&lt;/button&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-json" data-lang="json"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
 &lt;/div&gt;
&lt;/figure&gt;
&lt;p&gt;Both behaviors are pinned by retained tests. Neither can be interpreted from
the status code alone. Worse, the empty array is indistinguishable from an
authorized search which genuinely found nothing.&lt;/p&gt;</description></item><item><title>A Timeout Is Part of the Contract</title><link>https://vacua.dev/thoughts/a-timeout-is-part-of-the-contract/</link><pubDate>Fri, 01 Jul 2016 00:00:00 +0000</pubDate><guid>https://vacua.dev/thoughts/a-timeout-is-part-of-the-contract/</guid><description>&lt;p&gt;One remote accounting service would disappear for long periods and sometimes
return with an expired TLS certificate. Another integration scheduled
maintenance during peak operating hours. Work which normally completed
quickly could occupy application capacity while the dependency was unable to
help.&lt;/p&gt;
&lt;p&gt;A timeout would not have made either provider reliable. It would have answered
a question our callers still needed answered:&lt;/p&gt;
&lt;figure class="code-figure"&gt;
 &lt;div class="code-block" data-copy-code&gt;
 &lt;button class="copy-code" type="button" aria-label="Copy code"&gt;copy&lt;/button&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;How long may this attempt wait before its result is no longer useful?&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
 &lt;/div&gt;
&lt;/figure&gt;
&lt;p&gt;That answer belongs to the operation&amp;rsquo;s contract. Leaving it to a client
library&amp;rsquo;s default lets a transport decide how much of the customer&amp;rsquo;s time and
our worker capacity one dependency may consume.&lt;/p&gt;</description></item></channel></rss>