testinggospels / camouflage

Camouflage is a backend mocking tool for HTTP, gRPC, Websockets and Thrift protocols, which helps you carry out your front end prototyping, unit testing, functional/performance testing in silos, in absence of one or more Microservices/APIs.
https://testinggospels.github.io/camouflage/
MIT License
278 stars 26 forks source link

Receiving html <br> tags instead of \n in response #227

Open dagardner-nv opened 1 year ago

dagardner-nv commented 1 year ago

Describe the bug This is occurring with 0.14

To Reproduce Steps to reproduce the behavior:

  1. Mock File Content (https://github.com/nv-morpheus/Morpheus/blob/branch-23.11/tests/mock_triton_server/mocks/v2/models/abp-nvsmi-xgb/config/GET.mock)
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    Content-Length: 1400

{"name":"abp-nvsmi-xgb","platform":"","backend":"fil","version_policy":{"latest":{"num_versions":1}},"max_batch_size":32768,"input":[{"name":"input__0","data_type":"TYPE_FP32","format":"FORMAT_NONE","dims":[29],"is_shape_tensor":false,"allow_ragged_batch":false}],"output":[{"name":"output__0","data_type":"TYPE_FP32","dims":[1],"label_filename":"","is_shape_tensor":false}],"batch_input":[],"batch_output":[],"optimization":{"priority":"PRIORITY_DEFAULT","input_pinned_memory":{"enable":true},"output_pinned_memory":{"enable":true},"gather_kernel_buffer_threshold":0,"eager_batching":false},"dynamic_batching":{"preferred_batch_size":[1,4,8,12,16,20,24,28,32,64,128,256,512,1024,2048,4096,8192,16384,32768],"max_queue_delay_microseconds":50000,"preserve_ordering":false,"priority_levels":0,"default_priority_level":0,"priority_queue_policy":{}},"instance_group":[{"name":"abp-nvsmi-xgb_0","kind":"KIND_GPU","count":1,"gpus":[0,1,2,3,4,5,6,7],"secondary_devices":[],"profile":[],"passive":false,"host_policy":""}],"default_model_filename":"abp-nvsmi-xgb.bst","cc_model_filenames":{},"metric_tags":{},"parameters":{"storage_type":{"string_value":"AUTO"},"model_type":{"string_value":"xgboost"},"predict_proba":{"string_value":"false"},"threshold":{"string_value":"0.5"},"algo":{"string_value":"ALGO_AUTO"},"output_class":{"string_value":"true"},"blocks_per_sm":{"string_value":"0"}},"model_warmup":[]}

3. Folder Structure `mocks/v2/models/abp-nvsmi-xgb/config/GET.mock`
4. Error Stack Trace

$ curl "http://localhost:8000/v2/models/abp-nvsmi-xgb/config"

{"name":"abp-nvsmi-xgb","platform":"","backend":"fil","version_policy":{"latest":{"num_versions":1}},"max_batch_size":32768,"input":[{"name":"input__0","data_type":"TYPE_FP32","format":"FORMAT_NONE","dims":[29],"is_shape_tensor":false,"allow_ragged_batch":false}],"output":[{"name":"output__0","data_type":"TYPE_FP32","dims":[1],"label_filename":"","is_shape_tensor":false}],"batch_input":[],"batch_output":[],"optimization":{"priority":"PRIORITY_DEFAULT","input_pinned_memory":{"enable":true},"output_pinned_memory":{"enable":true},"gather_kernel_buffer_threshold":0,"eager_batching":false},"dynamic_batching":{"preferred_batch_size":[1,4,8,12,16,20,24,28,32,64,128,256,512,1024,2048,4096,8192,16384,32768],"max_queue_delay_microseconds":50000,"preserve_ordering":false,"priority_levels":0,"default_priority_level":0,"priority_queue_policy":{}},"instance_group":[{"name":"abp-nvsmi-xgb_0","kind":"KIND_GPU","count":1,"gpus":[0,1,2,3,4,5,6,7],"secondary_devices":[],"profile":[],"passive":false,"host_policy":""}],"default_model_filename":"abp-nvsmi-xgb.bst","cc_model_filenames":{},"metric_tags":{},"parameters":{"storage_type":{"string_value":"AUTO"},"model_type":{"string_value":"xgboost"},"predict_proba":{"string_value":"false"},"threshold":{"string_value":"0.5"},"algo":{"string_value":"ALGO_AUTO"},"output_class":{"string_value":"true"},"blocks_per_sm":{"string_value":"0"}},"model_warmup":[]}


**Expected behavior**
Return just the json content, not the `<br>` tags causing json parse errors

**Desktop (please complete the following information):**
 - OS: Debian Bullseye
 - Browser curl
 - Version 8.1.2

**Additional context**
Attach camouflage.log file

2023-08-04 08:55:22 info: [1568244] Worker started 2023-08-04 08:55:22 info: Handlebar helpers registration started 2023-08-04 08:55:22 warn: Code Injection is enabled. 2023-08-04 08:55:22 info: Handlebar helpers registration completed 2023-08-04 08:55:22 info: No middleware injection. (node:1568244) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated. (Use node --trace-deprecation ... to show where the warning was created) 2023-08-04 08:55:22 info: Worker sharing HTTP server at http://localhost:8000 ⛳ 2023-08-04 08:55:24 warn: Validation is disabled. Request and responses are not validated. 2023-08-04 08:55:24 debug: Using new line as \n 2023-08-04 08:55:24 debug: Response Status set to 200 2023-08-04 08:55:24 debug: Headers Set Content-Type: application/json 2023-08-04 08:55:24 debug: Headers Set Content-Length: 1400 2023-08-04 08:55:24 debug: Generated Response

{"name":"abp-nvsmi-xgb","platform":"","backend":"fil","version_policy":{"latest":{"num_versions":1}},"max_batch_size":32768,"input":[{"name":"input__0","data_type":"TYPE_FP32","format":"FORMAT_NONE","dims":[29],"is_shape_tensor":false,"allow_ragged_batch":false}],"output":[{"name":"output__0","data_type":"TYPE_FP32","dims":[1],"label_filename":"","is_shape_tensor":false}],"batch_input":[],"batch_output":[],"optimization":{"priority":"PRIORITY_DEFAULT","input_pinned_memory":{"enable":true},"output_pinned_memory":{"enable":true},"gather_kernel_buffer_threshold":0,"eager_batching":false},"dynamic_batching":{"preferred_batch_size":[1,4,8,12,16,20,24,28,32,64,128,256,512,1024,2048,4096,8192,16384,32768],"max_queue_delay_microseconds":50000,"preserve_ordering":false,"priority_levels":0,"default_priority_level":0,"priority_queue_policy":{}},"instance_group":[{"name":"abp-nvsmi-xgb_0","kind":"KIND_GPU","count":1,"gpus":[0,1,2,3,4,5,6,7],"secondary_devices":[],"profile":[],"passive":false,"host_policy":""}],"default_model_filename":"abp-nvsmi-xgb.bst","cc_model_filenames":{},"metric_tags":{},"parameters":{"storage_type":{"string_value":"AUTO"},"model_type":{"string_value":"xgboost"},"predict_proba":{"string_value":"false"},"threshold":{"string_value":"0.5"},"algo":{"string_value":"ALGO_AUTO"},"output_class":{"string_value":"true"},"blocks_per_sm":{"string_value":"0"}},"model_warmup":[]} 2023-08-04 08:55:24 debug: HTTP GET /v2/models/abp-nvsmi-xgb/config :: Query Parameters: {} | Request Headers {"host":"localhost:8000","user-agent":"curl/8.1.2","accept":"/"} | Request Body {}

shubhendumadhukar commented 1 year ago

should work now in 0.14.1

dagardner-nv commented 1 year ago

Awesome! Thanks for the quick response!

dagardner-nv commented 1 year ago

Confirmed, working in 0.14.2 (and 0.15)

dagardner-nv commented 11 months ago

This should be good to close.