0

Where can I download a simple Windows GUI app that can consume an HTTP POST, display its contents, and return 200?

0

2 Answers 2

1

This is really best done by writing a script and loading it into your favourite web server (IIS, Apache, whatever), and then pushing the POST to this file.

PHP:

<pre><?php
  print_r($_POST)
?></pre>

ASP Classic:

<%
    For Each Item In Request.Form
        For x=1 To Request.Form(item).Count
            Response.Write Item & ": " & Request.Form(Item)(x) & "<br>"
        Next
    Next 
%>

Credit where credit's due, ASP code blatantly lifted from here

The 200 response is automatically generated by the web server, since we are outputting valid code.

If you need a more of a "catch all" response (i.e. you want the web server to run this script regardless of whatever URL you're POSTing to) this can be done with a rewrite rule.

2
  • +1 this is by far the easiest way. Personally, I like to enclose my print_r's with <pre></pre> tags so it's at least vaguely readable. Mar 24, 2011 at 22:27
  • @Ben - good point, I'd forgotten about that (my scripting/coding skills are quite rusty these days). Mar 24, 2011 at 22:29
0

If you have/are willing to install Python, you can do it easily with dumdum, a tool I wrote

https://github.com/jar-o/dumdum

No code required. The idea here is that given a certain HTTP input, you want to respond with a certain output. That output (response) is fixed in relation to the input that is matched. dumdum allows the matches to fall through to other responses, so you can simulate an actual functioning server just by specifying a simple text format that resembles HTTP.

You can install with the pip utility: pip install dumdum. You'll get a library you can incorporate into your code, or a CLI tool, i.e. dumdum -h

1
  • Could you explain what your tool does and how to install it? May 22, 2017 at 16:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .