You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Send an invalid request to test request validation:
81
83
```shell
82
84
curl -i -X POST http://localhost:1323/hello
83
85
HTTP/1.1 422 Unprocessable Entity
84
86
Content-Type: application/json; charset=UTF-8
85
-
Date: Mon, 07 Nov 2022 01:13:40 GMT
87
+
Date: Sat, 12 Nov 2022 17:31:24 GMT
86
88
Content-Length: 117
87
89
88
90
{"message":"Validation error","errors":["parameter 'message' in query has an error: value is required but missing"]}
@@ -93,7 +95,7 @@ Send a valid request:
93
95
curl -i -X POST http://localhost:1323/hello\?message\=hello
94
96
HTTP/1.1 200 OK
95
97
Content-Type: application/json
96
-
Date: Mon, 07 Nov 2022 01:22:59 GMT
98
+
Date: Sat, 12 Nov 2022 17:31:47 GMT
97
99
Content-Length: 19
98
100
99
101
{"message":"hello"}
@@ -104,14 +106,14 @@ Send a valid request with an invalid response:
104
106
curl -i -X POST http://localhost:1323/hello\?message\=a
105
107
HTTP/1.1 500 Internal Server Error
106
108
Content-Type: application/json
107
-
Date: Mon, 07 Nov 2022 01:16:43 GMT
109
+
Date: Sat, 12 Nov 2022 17:31:01 GMT
108
110
Content-Length: 36
109
111
110
112
{"message":"Internal Server Error"}
111
113
```
112
114
You should also have the following in the server's log to help you debug your schema:
113
115
```shell
114
-
{"time":"2022-11-06T20:16:43.914629-05:00","level":"ERROR","prefix":"echo","file":"handler.go","line":"133","message":"response body doesn't match the schema: Error at \"/message\": minimum string length is 4\nSchema:\n {\n \"description\": \"Welcome message\",\n \"minLength\": 4,\n \"type\": \"string\"\n }\n\nValue:\n \"hi\"\n"}
116
+
{"error":"failed validating response: message: minimum string length is 4"}
0 commit comments