@@ -74,6 +74,9 @@ func getValidationTests(t *testing.T) []*validationTest {
7474 unsupportedContentType := newPetstoreRequest (t , http .MethodPost , "/pet" , bytes .NewBufferString (`{}` ))
7575 unsupportedContentType .Header .Set ("Content-Type" , "text/plain" )
7676
77+ unsupportedHeaderValue := newPetstoreRequest (t , http .MethodPost , "/pet" , bytes .NewBufferString (`{}` ))
78+ unsupportedHeaderValue .Header .Set ("x-environment" , "watdis" )
79+
7780 return []* validationTest {
7881 //
7982 // Basics
@@ -270,10 +273,43 @@ func getValidationTests(t *testing.T) []*validationTest {
270273 },
271274 },
272275
276+ //
277+ // Request header params
278+ //
279+ {
280+ name : "error - invalid enum value for header string parameter" ,
281+ args : validationArgs {
282+ r : unsupportedHeaderValue ,
283+ },
284+ wantErrParam : "x-environment" ,
285+ wantErrParamIn : "header" ,
286+ wantErrSchemaReason : "JSON value is not one of the allowed values" ,
287+ wantErrSchemaPath : "/" ,
288+ wantErrSchemaValue : "watdis" ,
289+ wantErrResponse : & ValidationError {Status : http .StatusBadRequest ,
290+ Title : "JSON value is not one of the allowed values" ,
291+ Detail : "Value 'watdis' at / must be one of: demo, prod" ,
292+ Source : & ValidationErrorSource {Parameter : "x-environment" }},
293+ },
294+
273295 //
274296 // Request bodies
275297 //
276298
299+ {
300+ name : "error - invalid enum value for header object attribute" ,
301+ args : validationArgs {
302+ r : newPetstoreRequest (t , http .MethodPost , "/pet" , bytes .NewBufferString (`{"status":"watdis"}` )),
303+ },
304+ wantErrReason : "doesn't match the schema" ,
305+ wantErrSchemaReason : "JSON value is not one of the allowed values" ,
306+ wantErrSchemaValue : "watdis" ,
307+ wantErrSchemaPath : "/status" ,
308+ wantErrResponse : & ValidationError {Status : http .StatusUnprocessableEntity ,
309+ Title : "JSON value is not one of the allowed values" ,
310+ Detail : "Value 'watdis' at /status must be one of: available, pending, sold" ,
311+ Source : & ValidationErrorSource {Pointer : "/status" }},
312+ },
277313 {
278314 name : "error - missing required object attribute" ,
279315 args : validationArgs {
0 commit comments