💾 Archived View for capsule.adrianhesketh.com › 2016 › 02 › 24 › dump-http-get-and-post-data captured on 2023-07-10 at 13:43:23. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-11-30)

-=-=-=-=-=-=-

capsule.adrianhesketh.com

home

Dump HTTP GET and POST Data

Had a bit of trouble with some HTTP postbacks today, after a customer reported receiving empty HTTP requests.

While the application was logging that it was working fine, we wanted to prove that the content was being received and that HTTP proxies were not affecting the content.

To do this, I put together a quick HTTP service in an Amazon AWS instance, setup to allow traffic on port 8080.

Once I'd installed python-pip and used it to install Flask, I cobbled together an app to dump the output to the console to verify the HTTP querystring and request content. Maybe you might find it useful:

import flask
app = flask.Flask(__name__)

@app.route("/", methods=['GET', 'POST'])
def hello():
  print("Headers")
  for header in flask.request.headers:
    print(str.format("{0}:{1}", header[0], header[1]))

  print(str.format("Querystring: {0}", flask.request.query_string))
  print(str.format("Post: {0}", flask.request.get_data()))
  return flask.request.get_data()


if __name__ == "__main__":
    app.debug = True
    app.run(host='0.0.0.0', port=8080)

More

Next

Using STS with Ansible's AWS Modules

Previous

MongoDB University

Home

home