Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm seeing the same thing.</p> <p>I found that the console would only show the last HTTP status code (200 OK), but with the debugger console I see a different code (304, "Not Modified". <a href="https://stackoverflow.com/questions/1665082/http-status-code-200-cache-vs-status-code-304">More on that here</a>)</p> <p>The nature of the 304 code is that the response will be empty, because the server is telling your browser to just use cache. Your browser is sending a conditional GET (which should be normal browser behavior?) and that's what's causing your server to behave this way. Your browser is unaware that you're in development mode, so it's going to behave as it normally would.</p> <p>Note that I was able to sidestep this error by doing CTRL-F5 for a refresh (in Firefox), which is a command for "refresh and ignore cache". So the browser does a plain GET instead of a conditional one.</p> <p>Here's the code I used to help me figure out what was going on (requires the <code>ruby-debug</code> gem).</p> <pre><code>def call(env) status, headers, response = @app.call(env) debugger if headers["Content-Type"].include?("text/html") [status, headers, "&lt;!--hello world! --&gt;" + response.body] else [status, headers, response] end end </code></pre> <p>After doing this, load the page and in the <code>rail server</code> terminal:</p> <pre><code>(rdb:1) irb irb(#&lt;PostRedirect:0x7f9c6292a530&gt;):001:0&gt; status =&gt; 304 </code></pre> <p>My fix was to add a status code check:</p> <pre><code> if (status != 304) &amp;&amp; headers["Content-Type"].include?("text/html") </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload