title: Compressed with pako(zlib in javascript), decompressing with zlib(python) not working
body: <p>The code that does the compression in javascript using pako(<a href="https://github.com/nodeca/pako" rel="nofollow noreferrer">https://github.com/nodeca/pako</a>)<a href="https://github.com/nodeca/pako" rel="nofollow noreferrer">Pako</a>. It compresses string 't'</p>
  
  <pre><code>var compressedString = pako.gzip('t', {level: 4, to: 'string'}));
  $.ajax('/decompress', {string: compressedString})
  </code></pre>
  
  <p>The code at /decompress that does the decompression</p>
  
  <pre><code>from cgi import parse_qs, escape
  import json
  import zlib
  def application(environ, start_response):
      status = '200 OK'
      try:
          request_body_size = int(environ.get('CONTENT_LENGTH', 0))
      except (ValueError):
          request_body_size = 0
      request_body = environ['wsgi.input'].read(request_body_size)
      d = parse_qs(request_body)
  
      response_headers = [('Content-type', 'text/plain')]
      start_response(status, response_headers)
      inputString = d.get('string')[0]
      # Use same wbits(=31) as used by pako
      decompressed = zlib.decompress(inputString, 31);
      return 'done'
  </code></pre>
  
  <p>Doing the decompression throws following error. The error occurs for zlib.decompress line.</p>
  
  <blockquote>
    <p>error: Error -3 while decompressing data: incorrect header check</p>
  </blockquote>
  
  <p>I also tried encoding the inputString(</p>
  
  <blockquote>
    <p>inputString.encode('utf-8')</p>
  </blockquote>
  
  <p>) but it also throws the error.</p>