title: Session header too large causes error in Flask app
body: <p>I am using Flask 0.12.2 running on Python 3.6.5.</p>
  
  <p>When I run the app the first thing that the program does is to check if there is something stored in the session (using the flask session).
  Also there's a function that identifies if something called the intent is 'RelationshipQuestion', when you first run the app theres nothing stored on the session, but when it get's into 'RelationshipQuestion' I set the 'intent' on session like this:</p>
  
  <pre><code>session['intent'] = "RelationshipQuestion"
  </code></pre>
  
  <p>I use the session['intent'] for other cases and it works just fine, but however in this case althought the app returns the content correctly I get this warning:</p>
  
  <pre><code>    UserWarning: The "b'session'" cookie is too large: the value was 14708
  bytes but the header required 26 extra bytes. The final size was 14734 bytes but
  the limit is 4093 bytes. Browsers may silently ignore cookies larger than this.
  samesite=samesite
  </code></pre>
  
  <p>for the rest of the tipes of 'intents' in session I don´t get this warning and
  i have already checked session size of all keys stored at this point, with this:</p>
  
  <pre><code>tamanio= 0
  for key in session:
      tamanio+= getsizeof(session[key])
  </code></pre>
  
  <p>and the size was:</p>
  
  <pre><code>365 bytes
  </code></pre>
  
  <p>after that I check if:</p>
  
  <pre><code>'intent' in session and session['intent'] == "RelationshipQuestion"
  </code></pre>
  
  <p>and as it doesn't recognize any ['intent'] I get this error: </p>
  
  <pre><code>raise ValueError('View function did not return a response')
  ValueError: View function did not return a response
  </code></pre>
  
  <p>Already checked not erasing the session['intent'] and this is working perfectly fine for other session['intent']s</p>
  
  <p>How can the session header be so large? Is there any better way of checking header size?
  Could it be that the session somehow gets filled on the header and that's why it doesn't store the intent?</p>
  
  <p>This warning it's only for this particular case, but all of the other cases are working perfectly fine (and they are built in the same way),
  I only get this warning and error in this case</p>