From 4641925909819c6a93fb774cf1ca77805b74210d Mon Sep 17 00:00:00 2001 From: Shulhan Date: Thu, 8 Feb 2024 16:29:46 +0700 Subject: all: allow submit free form request body in HTTPTarget In HTTPTarget the field RawBody can be filled by anything by user. Those field can be activated by setting WithRawBody. Implements: https://todo.sr.ht/~shulhan/gorankusu/3 --- testdata/target_http_run_withrawbody_json_test.txt | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 testdata/target_http_run_withrawbody_json_test.txt (limited to 'testdata') diff --git a/testdata/target_http_run_withrawbody_json_test.txt b/testdata/target_http_run_withrawbody_json_test.txt new file mode 100644 index 0000000..c332987 --- /dev/null +++ b/testdata/target_http_run_withrawbody_json_test.txt @@ -0,0 +1,33 @@ +Test data for testing [HTTPTarget.WithRawBody]. + +>>> valid:http_request_body +{ + "Target": { + "id": "target_http" + }, + "HTTPTarget": { + "id": "rawbody_json", + "Method": 6, + "RequestType": 4, + "Path": "/rawbody/json", + "RawBody": "eyJpZCI6MSwibmFtZSI6ImdvcmFua3VzdSJ9", + "WithRawBody": true + } +} + +<<< valid:RunResponse.DumpRequest +POST /rawbody/json HTTP/1.1 +Host: 127.0.0.1:22796 +User-Agent: libhttp/0.53.0 +Content-Length: 27 +Content-Type: application/json +Accept-Encoding: gzip + +{"id":1,"name":"gorankusu"} + +<<< valid:RunResponse.DumpResponse +HTTP/1.1 200 OK +Content-Length: 47 +Content-Type: application/json + +{"data":{"id":1,"name":"gorankusu"},"code":200} -- cgit v1.3