jhthorsen / json-validator

:cop: Validate data against a JSON schema
https://metacpan.org/release/JSON-Validator
56 stars 57 forks source link

Lots of warnings when processing Accept header #252

Closed xurc closed 3 years ago

xurc commented 3 years ago

Presumably after this commit there were a lot of warnings in the log

https://github.com/jhthorsen/json-validator/commit/f9c20132ad38c7152e5faa4a1e9ee9ead5b71fb8

Steps to reproduce the behavior

Make any GET (at least) request with header

Accept: application/json, text/plain, */*

Expected behavior

No warnings in log

Actual behavior

Use of uninitialized value $header_map{"*/*"} in numeric comparison (<=>) at /usr/local/share/perl/5.28.1/JSON/Validator/Util.pm line 98.
Use of uninitialized value $header_map{"application/json"} in numeric comparison (<=>) at /usr/local/share/perl/5.28.1/JSON/Validator/Util.pm line 98.
Use of uninitialized value $header_map{"*/*"} in numeric comparison (<=>) at /usr/local/share/perl/5.28.1/JSON/Validator/Util.pm line 98.
Use of uninitialized value $header_map{"text/plain"} in numeric comparison (<=>) at /usr/local/share/perl/5.28.1/JSON/Validator/Util.pm line 98.
Use of uninitialized value $header_map{"text/plain"} in numeric comparison (<=>) at /usr/local/share/perl/5.28.1/JSON/Validator/Util.pm line 98.
Use of uninitialized value $header_map{"application/json"} in numeric comparison (<=>) at /usr/local/share/perl/5.28.1/JSON/Validator/Util.pm line 98.
jhthorsen commented 3 years ago

I think it's very strange for an API request to not specify what it wants, but nevertheless the bug is fixed 👍

xurc commented 3 years ago

I think it's very strange for an API request to not specify what it wants

This appeared in the logs on the dev environment just during the development process.

but nevertheless the bug is fixed 👍

Thank you so much!