Skip to content

Commit 5852fee

Browse files
committed
Final update of tests and docs
1 parent 0d5e710 commit 5852fee

File tree

136 files changed

+342
-194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+342
-194
lines changed

Diff for: EXAMPLES.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ $ docker run -v "$PWD/test/proto:/proto" --network host qaware/protocurl \
2626
-u http://localhost:8080/happy-day/verify \
2727
-d "includeReason: true"
2828

29-
=========================== POST Request Text =========================== >>>
29+
=========================== POST Request Text =========================== >>>
3030
includeReason: true
3131
=========================== POST Response Text =========================== <<<
3232
isHappyDay: true
@@ -41,7 +41,7 @@ $ docker run -v "$PWD/test/proto:/proto" --network host qaware/protocurl \
4141
-f happyday.proto -i happyday.HappyDayRequest -o happyday.HappyDayResponse \
4242
-u http://localhost:8080/happy-day/verify -d ""
4343

44-
=========================== POST Request Text =========================== >>>
44+
=========================== POST Request Text =========================== >>>
4545

4646
=========================== POST Response Text =========================== <<<
4747
isHappyDay: true
@@ -56,7 +56,7 @@ $ docker run -v "$PWD/test/proto:/proto" --network host qaware/protocurl \
5656
-u http://localhost:8080/happy-day/verify \
5757
-d "date: { seconds: 1648044939}"
5858

59-
=========================== POST Request Text =========================== >>>
59+
=========================== POST Request Text =========================== >>>
6060
date: {
6161
seconds: 1648044939
6262
}
@@ -96,7 +96,7 @@ $ docker run -v "$PWD/test/proto:/proto" --network host qaware/protocurl \
9696
-u http://localhost:8080/happy-day/verify \
9797
-d "{ \"date\": \"2022-03-23T14:15:39Z\" }"
9898

99-
=========================== POST Request JSON =========================== >>>
99+
=========================== POST Request JSON =========================== >>>
100100
{"date":"2022-03-23T14:15:39Z"}
101101
=========================== POST Response JSON =========================== <<<
102102
{"formattedDate":"Wed, 23 Mar 2022 14:15:39 GMT"}
@@ -110,7 +110,7 @@ $ docker run -v "$PWD/test/proto:/proto" --network host qaware/protocurl \
110110
-u http://localhost:8080/happy-day/verify --out=json:pretty \
111111
-d "{ \"date\": \"2022-03-23T14:15:39Z\" }"
112112

113-
=========================== POST Request JSON =========================== >>>
113+
=========================== POST Request JSON =========================== >>>
114114
{"date":"2022-03-23T14:15:39Z"}
115115
=========================== POST Response JSON =========================== <<<
116116
{
@@ -157,7 +157,7 @@ $ docker run -v "$PWD/test/proto:/proto" --network host qaware/protocurl \
157157
-d "date: { seconds: 1648044939}" \
158158
--curl -n -H 'Content-Type: application/octet-stream'
159159

160-
=========================== POST Request Text =========================== >>>
160+
=========================== POST Request Text =========================== >>>
161161
date: {
162162
seconds: 1648044939
163163
}
@@ -410,7 +410,7 @@ Searching for message with base name: HappyDayRequest
410410
Resolved message package-paths for name HappyDayRequest: [happyday.HappyDayRequest]
411411
Searching for message with base name: HappyDayRequest
412412
Resolved message package-paths for name HappyDayRequest: [happyday.HappyDayRequest]
413-
=========================== POST Request Text =========================== >>>
413+
=========================== POST Request Text =========================== >>>
414414
date: {
415415
seconds: 1648044939
416416
}
@@ -435,7 +435,7 @@ Total curl args:
435435
=========================== POST Response Headers =========================== <<<
436436
HTTP/1.1 200 OK
437437
Content-Type: application/x-protobuf
438-
Date: Tue, 03 Oct 2023 20:46:17 GMT
438+
Date: Thu, 05 Oct 2023 09:21:38 GMT
439439
Connection: keep-alive
440440
Keep-Alive: timeout=5
441441
Content-Length: 35

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Then protocurl will
103103
and produce the following output:
104104

105105
```
106-
=========================== POST Request Text =========================== >>>
106+
=========================== POST Request Text =========================== >>>
107107
includeReason: true
108108
=========================== POST Response Text =========================== <<<
109109
isHappyDay: true

Diff for: TESTS.md

+159-10
Large diffs are not rendered by default.

Diff for: doc/generated.usage.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Flags:
2828
-h, --help help for protocurl
2929
--in string Specifies, in which format the input -d should be interpreted in. 'text' (default) uses the Protobuf text format and 'json' uses JSON. The type is inferred as JSON if the first token is a '{'.
3030
-F, --infer-files Infer the correct files containing the relevant protobuf messages. All proto files in the proto directory provided by -I will be used. If no -f <file> is provided, this -F is set and the files are inferred.
31-
-X, --method string HTTP request method. POST and GET are explicitly supported. Other methods are passed on on to curl optimistically. (default "POST")
31+
-X, --method string HTTP request method. POST and GET are explicitly supported. Other methods are passed on to curl optimistically. (default "POST")
3232
--no-curl Forces the use of the built-in internal http request instead of curl.
3333
-n, --no-default-headers Default headers (e.g. "Content-Type") will not be passed to curl. Assumes --curl. Use "-n -H 'Content-Type: FooBar'" to override the default content type.
3434
--out string Produces the output in the specified format. 'text' (default) produces Protobuf text format. 'json' produces dense JSON and 'json:pretty' produces pretty-printed JSON. The produced JSON always uses the original Protobuf field names instead of lowerCamelCasing them.

Diff for: src/flags.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func intialiseFlags() {
6161
"Infer the correct files containing the relevant protobuf messages. All proto files in the proto directory provided by -I will be used. If no -f <file> is provided, this -F is set and the files are inferred.")
6262

6363
flags.StringVarP(&CurrentConfig.Method, "method", "X", "POST",
64-
"HTTP request method. POST and GET are explicitly supported. Other methods are passed on on to curl optimistically.")
64+
"HTTP request method. POST and GET are explicitly supported. Other methods are passed on to curl optimistically.")
6565

6666
flags.StringVarP(&CurrentConfig.RequestType, "request-type", "i", "",
6767
"Message name or full package path of the Protobuf request type. The path can be shortened to '..', if the name of the request message is unique. Mandatory for POST requests. E.g. mypackage.MyRequest or ..MyRequest")

Diff for: src/protocurl.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ func encodeToBinary(requestType string, text string, registry *protoregistry.Fil
113113
)
114114

115115
if !CurrentConfig.ShowOutputOnly {
116-
// todo. remove one space here for aligned output
117-
fmt.Printf("%s %s Request %s %s %s\n%s\n",
116+
fmt.Printf("%s %s Request %s %s %s\n%s\n",
118117
VISUAL_SEPARATOR, CurrentConfig.Method, displayIn(CurrentConfig.InTextType), VISUAL_SEPARATOR,
119118
SEND, reconstructedRequestText)
120119
}

Diff for: test/results/additional-curl-args--X_GET-expected.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
######### STDOUT #########
2-
=========================== GET Request Text =========================== >>>
2+
=========================== GET Request Text =========================== >>>
33
date: {
44
seconds: 1642044939
55
nanos: 152000000
@@ -10,7 +10,7 @@ includeReason: true
1010
=========================== GET Response Headers =========================== <<<
1111
HTTP/1.1 200 OK
1212
Content-Type: application/x-protobuf
13-
Date: Wed, 04 Oct 2023 08:55:15 GMT
13+
Date: Thu, 05 Oct 2023 09:18:01 GMT
1414
Connection: keep-alive
1515
Keep-Alive: timeout=5
1616
Content-Length: 65

Diff for: test/results/additional-curl-args-expected.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
######### STDOUT #########
2-
=========================== POST Request Text =========================== >>>
2+
=========================== POST Request Text =========================== >>>
33
date: {
44
seconds: 1642044939
55
nanos: 152000000
@@ -10,7 +10,7 @@ includeReason: true
1010
=========================== POST Response Headers =========================== <<<
1111
HTTP/1.1 200 OK
1212
Content-Type: application/x-protobuf
13-
Date: Tue, 03 Oct 2023 20:42:35 GMT
13+
Date: Thu, 05 Oct 2023 09:18:00 GMT
1414
Connection: keep-alive
1515
Keep-Alive: timeout=5
1616
Content-Length: 65

Diff for: test/results/additional-curl-args-verbose--X_GET-expected.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ Searching for message with base name: HappyDayRequest
235235
Resolved message package-paths for name HappyDayRequest: [happyday.HappyDayRequest]
236236
Searching for message with base name: HappyDayRequest
237237
Resolved message package-paths for name HappyDayRequest: [happyday.HappyDayRequest]
238-
=========================== GET Request Text =========================== >>>
238+
=========================== GET Request Text =========================== >>>
239239
date: {
240240
seconds: 1642044939
241241
nanos: 152000000
@@ -279,7 +279,7 @@ Total curl args:
279279
* Mark bundle as not supporting multiuse
280280
< HTTP/1.1 200 OK
281281
< Content-Type: application/x-protobuf
282-
< Date: Wed, 04 Oct 2023 08:55:21 GMT
282+
< Date: Thu, 05 Oct 2023 09:18:02 GMT
283283
< Connection: keep-alive
284284
< Keep-Alive: timeout=5
285285
< Content-Length: 65
@@ -290,7 +290,7 @@ Total curl args:
290290
=========================== GET Response Headers =========================== <<<
291291
HTTP/1.1 200 OK
292292
Content-Type: application/x-protobuf
293-
Date: Wed, 04 Oct 2023 08:55:21 GMT
293+
Date: Thu, 05 Oct 2023 09:18:02 GMT
294294
Connection: keep-alive
295295
Keep-Alive: timeout=5
296296
Content-Length: 65

Diff for: test/results/additional-curl-args-verbose-expected.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ Searching for message with base name: HappyDayRequest
235235
Resolved message package-paths for name HappyDayRequest: [happyday.HappyDayRequest]
236236
Searching for message with base name: HappyDayRequest
237237
Resolved message package-paths for name HappyDayRequest: [happyday.HappyDayRequest]
238-
=========================== POST Request Text =========================== >>>
238+
=========================== POST Request Text =========================== >>>
239239
date: {
240240
seconds: 1642044939
241241
nanos: 152000000
@@ -279,7 +279,7 @@ Total curl args:
279279
* Mark bundle as not supporting multiuse
280280
< HTTP/1.1 200 OK
281281
< Content-Type: application/x-protobuf
282-
< Date: Tue, 03 Oct 2023 20:42:36 GMT
282+
< Date: Thu, 05 Oct 2023 09:18:01 GMT
283283
< Connection: keep-alive
284284
< Keep-Alive: timeout=5
285285
< Content-Length: 65
@@ -290,7 +290,7 @@ Total curl args:
290290
=========================== POST Response Headers =========================== <<<
291291
HTTP/1.1 200 OK
292292
Content-Type: application/x-protobuf
293-
Date: Tue, 03 Oct 2023 20:42:36 GMT
293+
Date: Thu, 05 Oct 2023 09:18:01 GMT
294294
Connection: keep-alive
295295
Keep-Alive: timeout=5
296296
Content-Length: 65

Diff for: test/results/display-binary-and-headers--X_GET-expected.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
######### STDOUT #########
2-
=========================== GET Request Text =========================== >>>
2+
=========================== GET Request Text =========================== >>>
33
date: {
44
seconds: 1642044939
55
nanos: 152000000
@@ -10,7 +10,7 @@ includeReason: true
1010
=========================== GET Response Headers =========================== <<<
1111
HTTP/1.1 200 OK
1212
Content-Type: application/x-protobuf
13-
Date: Wed, 04 Oct 2023 08:55:07 GMT
13+
Date: Thu, 05 Oct 2023 09:18:00 GMT
1414
Connection: keep-alive
1515
Keep-Alive: timeout=5
1616
Content-Length: 65

Diff for: test/results/display-binary-and-headers-expected.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
######### STDOUT #########
2-
=========================== POST Request Text =========================== >>>
2+
=========================== POST Request Text =========================== >>>
33
date: {
44
seconds: 1642044939
55
nanos: 152000000
@@ -10,7 +10,7 @@ includeReason: true
1010
=========================== POST Response Headers =========================== <<<
1111
HTTP/1.1 200 OK
1212
Content-Type: application/x-protobuf
13-
Date: Tue, 03 Oct 2023 20:42:35 GMT
13+
Date: Thu, 05 Oct 2023 09:17:59 GMT
1414
Connection: keep-alive
1515
Keep-Alive: timeout=5
1616
Content-Length: 65

Diff for: test/results/display-binary-and-headers-no-curl-expected.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
######### STDOUT #########
2-
=========================== POST Request Text =========================== >>>
2+
=========================== POST Request Text =========================== >>>
33
date: {
44
seconds: 1642044939
55
nanos: 152000000
@@ -12,7 +12,7 @@ HTTP/1.1 200 OK
1212
Content-Length: 65
1313
Connection: keep-alive
1414
Content-Type: application/x-protobuf
15-
Date: Tue, 03 Oct 2023 20:42:35 GMT
15+
Date: Thu, 05 Oct 2023 09:17:59 GMT
1616
Keep-Alive: timeout=5
1717
=========================== POST Response Binary =========================== <<<
1818
00000000 08 01 12 1c 54 68 75 72 73 64 61 79 20 69 73 20 |....Thursday is |

Diff for: test/results/echo-empty--X_GET-expected.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
######### STDOUT #########
2-
=========================== GET Request Text =========================== >>>
2+
=========================== GET Request Text =========================== >>>
33

44
=========================== GET Response Text =========================== <<<
55

Diff for: test/results/echo-empty--X_GET_-v-expected.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ file: {
231231
}
232232
Looking up message with full name: happyday.HappyDayRequest
233233
Looking up message with full name: happyday.HappyDayRequest
234-
=========================== GET Request Text =========================== >>>
234+
=========================== GET Request Text =========================== >>>
235235

236236
=========================== GET Request Binary =========================== >>>
237237
Found curl: /usr/bin/curl
@@ -253,7 +253,7 @@ Total curl args:
253253
=========================== GET Response Headers =========================== <<<
254254
HTTP/1.1 200 OK
255255
Content-Type: application/x-protobuf
256-
Date: Wed, 04 Oct 2023 12:50:55 GMT
256+
Date: Thu, 05 Oct 2023 09:18:15 GMT
257257
Connection: keep-alive
258258
Keep-Alive: timeout=5
259259
Content-Length: 0

Diff for: test/results/echo-empty--X_HEAD-expected.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
######### STDOUT #########
2-
=========================== HEAD Request Text =========================== >>>
2+
=========================== HEAD Request Text =========================== >>>
33

44
=========================== HEAD Response Text =========================== <<<
55

Diff for: test/results/echo-empty--X_HEAD_--no-curl-expected.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
######### STDOUT #########
2-
=========================== HEAD Request Text =========================== >>>
2+
=========================== HEAD Request Text =========================== >>>
33

44
######### STDERR #########
55
Error: HTTP method HEAD not supported with internal HTTP implementation. Please use curl.

Diff for: test/results/echo-empty--X_HEAD_-v-expected.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ file: {
231231
}
232232
Looking up message with full name: happyday.HappyDayRequest
233233
Looking up message with full name: happyday.HappyDayRequest
234-
=========================== HEAD Request Text =========================== >>>
234+
=========================== HEAD Request Text =========================== >>>
235235

236236
=========================== HEAD Request Binary =========================== >>>
237237
Found curl: /usr/bin/curl
@@ -253,7 +253,7 @@ Total curl args:
253253
=========================== HEAD Response Headers =========================== <<<
254254
HTTP/1.1 200 OK
255255
Content-Type: application/x-protobuf
256-
Date: Wed, 04 Oct 2023 12:50:02 GMT
256+
Date: Thu, 05 Oct 2023 09:18:21 GMT
257257
Connection: keep-alive
258258
Keep-Alive: timeout=5
259259
=========================== HEAD Response Binary =========================== <<<

Diff for: test/results/echo-empty-expected.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
######### STDOUT #########
2-
=========================== POST Request Text =========================== >>>
2+
=========================== POST Request Text =========================== >>>
33

44
=========================== POST Response Text =========================== <<<
55

Diff for: test/results/echo-empty-no-curl-expected.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
######### STDOUT #########
2-
=========================== POST Request Text =========================== >>>
2+
=========================== POST Request Text =========================== >>>
33

44
=========================== POST Response Text =========================== <<<
55

Diff for: test/results/echo-empty-with-curl-args--X_GET-expected.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
######### STDOUT #########
2-
=========================== GET Request Text =========================== >>>
2+
=========================== GET Request Text =========================== >>>
33
includeReason: true
44
=========================== CURL ERROR ===========================
55
* Trying 127.0.0.1:8080...
@@ -16,7 +16,7 @@ includeReason: true
1616
* Mark bundle as not supporting multiuse
1717
< HTTP/1.1 200 OK
1818
< Content-Type: application/x-protobuf
19-
< Date: Wed, 04 Oct 2023 08:57:18 GMT
19+
< Date: Thu, 05 Oct 2023 09:18:28 GMT
2020
< Connection: keep-alive
2121
< Keep-Alive: timeout=5
2222
< Content-Length: 2

Diff for: test/results/echo-empty-with-curl-args-expected.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
######### STDOUT #########
2-
=========================== POST Request Text =========================== >>>
2+
=========================== POST Request Text =========================== >>>
33
includeReason: true
44
=========================== CURL ERROR ===========================
55
* Trying 127.0.0.1:8080...
@@ -16,7 +16,7 @@ includeReason: true
1616
* Mark bundle as not supporting multiuse
1717
< HTTP/1.1 200 OK
1818
< Content-Type: application/x-protobuf
19-
< Date: Tue, 03 Oct 2023 20:42:44 GMT
19+
< Date: Thu, 05 Oct 2023 09:18:27 GMT
2020
< Connection: keep-alive
2121
< Keep-Alive: timeout=5
2222
< Content-Length: 2

Diff for: test/results/echo-filled--X_GET-expected.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
######### STDOUT #########
2-
=========================== GET Request Text =========================== >>>
2+
=========================== GET Request Text =========================== >>>
33
date: {
44
seconds: 1648044939
55
nanos: 152000000

Diff for: test/results/echo-filled-expected.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
######### STDOUT #########
2-
=========================== POST Request Text =========================== >>>
2+
=========================== POST Request Text =========================== >>>
33
date: {
44
seconds: 1648044939
55
nanos: 152000000

Diff for: test/results/echo-filled-no-curl-expected.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
######### STDOUT #########
2-
=========================== POST Request Text =========================== >>>
2+
=========================== POST Request Text =========================== >>>
33
date: {
44
seconds: 1648044939
55
nanos: 152000000

Diff for: test/results/echo-full--X_GET-expected.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
######### STDOUT #########
2-
=========================== GET Request Text =========================== >>>
2+
=========================== GET Request Text =========================== >>>
33
date: {
44
seconds: 1648044939
55
nanos: 152000000

Diff for: test/results/echo-full-expected.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
######### STDOUT #########
2-
=========================== POST Request Text =========================== >>>
2+
=========================== POST Request Text =========================== >>>
33
date: {
44
seconds: 1648044939
55
nanos: 152000000

Diff for: test/results/echo-full-json--X_GET-expected.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
######### STDOUT #########
2-
=========================== GET Request JSON =========================== >>>
2+
=========================== GET Request JSON =========================== >>>
33
{"includeReason":true,"double":0.12346789,"int32":123123123,"int64":"123123123123123","string":"some string here","bytes":"AAEC//79","fooEnum":"BAZ","misc":[{},{"weatherOfPastFewDays":["1","2"],"fooEnum":"FAZ"},{"fooString":"abc"}],"float":0.123}
44
=========================== GET Response JSON =========================== <<<
55
{"includeReason":true,"double":0.12346789,"int32":123123123,"int64":"123123123123123","string":"some string here","bytes":"AAEC//79","fooEnum":"BAZ","misc":[{},{"weatherOfPastFewDays":["1","2"],"fooEnum":"FAZ"},{"fooString":"abc"}],"float":0.123}

Diff for: test/results/echo-full-json-expected.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
######### STDOUT #########
2-
=========================== POST Request JSON =========================== >>>
2+
=========================== POST Request JSON =========================== >>>
33
{"includeReason":true,"double":0.12346789,"int32":123123123,"int64":"123123123123123","string":"some string here","bytes":"AAEC//79","fooEnum":"BAZ","misc":[{},{"weatherOfPastFewDays":["1","2"],"fooEnum":"FAZ"},{"fooString":"abc"}],"float":0.123}
44
=========================== POST Response JSON =========================== <<<
55
{"includeReason":true,"double":0.12346789,"int32":123123123,"int64":"123123123123123","string":"some string here","bytes":"AAEC//79","fooEnum":"BAZ","misc":[{},{"weatherOfPastFewDays":["1","2"],"fooEnum":"FAZ"},{"fooString":"abc"}],"float":0.123}

0 commit comments

Comments
 (0)