HTTP server which receives requests and dumps them to a flat file.
Start HTTP server:
$ nodejs ./httprequestdump.js
Listening on 0.0.0.0:8080
Now make a curl
request:
$ curl \
--data-urlencode "param1=value" \
--data-urlencode "param2=value" \
--verbose \
http://127.0.0.1:8080/my/path/
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> POST /my/path/ HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-Length: 25
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 25 out of 25 bytes
< HTTP/1.1 200 OK
< Content-Type: text/plain
< Date: Fri, 27 May 2016 05:37:56 GMT
< Connection: keep-alive
< Transfer-Encoding: chunked
<
HELLO
* Connection #0 to host 127.0.0.1 left intact
Then view the captured response:
Incoming request
Method: POST
URI: /my/path/
End of request, 25 bytes received.
$ cat dumpdata.txt
Method: POST
URI: /my/path/
Headers:
accept: */*
content-length: 25
content-type: application/x-www-form-urlencoded
host: 127.0.0.1:8080
user-agent: curl/7.35.0
param1=value¶m2=value
BTW you can also solve CORS by using this block instead:
(use this on line 37-40)