Open RomanKornev opened 2 years ago
I confirm the problem
When receiving JSON with non-acsii characters from the server, For example, something like this
[ { "id": 1, "short_name": "Техноэнерго", "name": "Техноэнерго 1 1 ", "series": "1", "type": "1", "number_of_phases": 3, "type_of_inclusion": "прямого", "rated_current": "1(10)", "execution": "электронный", "reporting_device": "ЖКИ", "energy_type": "активный", "number_of_directions": "однонаправленный", "accuracy_class": "1", "value_before_comma": 6, "zero_discharges_before_comma": 0, "value_after_comma": 1, "zero_discharges_after_comma": 0, "intertest_interval": 16, "form_factor_body": "на щиток", "stores_load_profile": 0, "price_category": "только 1ЦК", "meets_isu_requirements": 0, "possibility_using_oreim": 0, "offer_sitel": 0, "description": "Может служить в качестве ОДПУ. После устранения замечаний, потребителей с ", "ordinal_number": 14, "end_at": null, "status": 1, "interface": "[{\"id\":1,\"name\":\"оптический порт2\"}]", "created_at": "2022-08-25T19:28:06Z", "created_by": 1, "created_by_name": "Тестов Тестер Тестерович", "updated_at": "2023-01-23T09:23:31Z", "updated_by": 3, "updated_by_name": "Белов Максим Александрович" },
TypeError: Invalid character in header content ["sl-violations"]
at ServerResponse.setHeader (node:_http_outgoing:606:3)
at addViolationHeader (C:\Users\Offlu\AppData\Roaming\nvm\v16.17.0\node_modules\@stoplight\prism-cli\node_modules\@stoplight\prism-http-server\dist\server.js:39:11)
at C:\Users\Offlu\AppData\Roaming\nvm\v16.17.0\node_modules\@stoplight\prism-cli\node_modules\@stoplight\prism-http-server\dist\server.js:77:17
at C:\Users\Offlu\AppData\Roaming\nvm\v16.17.0\node_modules\@stoplight\prism-cli\node_modules\fp-ts\lib\function.js:197:30
at C:\Users\Offlu\AppData\Roaming\nvm\v16.17.0\node_modules\@stoplight\prism-cli\node_modules\fp-ts\lib\EitherT.js:83:97
at C:\Users\Offlu\AppData\Roaming\nvm\v16.17.0\node_modules\@stoplight\prism-cli\node_modules\fp-ts\lib\Task.js:133:41
at processTicksAndRejections (node:internal/process/task_queues:96:5)
I understood the problem a little better. Such characters are contained in enum and cannot be rejected or described with ACSII characters. This makes it impossible to use Proxy on OpenApi documents with Russian characters in regex patterns, and the already mentioned Enums.
Describe the bug
Prism fails to send a response if specification's validation pattern contains non-ascii characters. Request is stuck forever.
To Reproduce
spec.yaml
prism mock spec.yaml
Expected behavior
An error message response was sent to the client.
Environment (remove any that are not applicable):