usebruno / bruno

Opensource IDE For Exploring and Testing Api's (lightweight alternative to postman/insomnia)
https://www.usebruno.com/
MIT License
27.19k stars 1.24k forks source link

POST request which works fine from CURL does not in Bruno #3328

Open Rickcau opened 3 weeks ago

Rickcau commented 3 weeks ago

I have checked the following:

Describe the bug

Bruno fails with a 404 error with trying to make a POST request to Azure AI Language service. The same POST request works fine from CURL. This works fine from Postman, Insomnia and CURL just not Bruno (see the screen shot below for example of this working from CURL)

Steps to Reproduce the issue.

  1. Open the Azure Portal and setup an AI Language Service
  2. Navigate to the service and copy the endpoint URL as well as the API Key
  3. You can verify that the service is working through the Language Studio by trying the PII demo and point it to the service you just provisioned.

Next Steps:

  1. Open a Command Prompt on Windows and run either of the CURL commands below, but make sure to replace the endpoint and the key with the service you just provisioned.

Example1: curl -v -X POST "https://ai-language-service-cw.cognitiveservices.azure.com/language/:analyze-text?api-version=2023-04-01" -H "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key: 123_your_key" --data-ascii "{\"kind\":\"PiiEntityRecognition\",\"analysisInput\":{\"documents\":[{\"id\":\"documentId\",\"text\":\"Hello, my SSN is 111-11-1111\",\"language\":\"en\"}]},\"parameters\":{\"domain\":\"none\"}}"

Example2: curl --request POST \ --url 'https://ai-language-service.cognitiveservices.azure.com/language/?api-version=2023-04-01' \ --header 'Content-Type: application/json' \ --header 'Ocp-Apim-Subscription-Key: 1234-your-key' \ --header 'content-type: application/json' \ --data '"{\"kind\":\"PiiEntityRecognition\",\"analysisInput\":{\"documents\":[{\"id\":\"documentId\",\"text\":\"Hello, my SSN is 111-11-1111\",\"language\":\"en\"}]},\"parameters\":{\"domain\":\"none\"}}"'

.bru file to reproduce the bug

{ "type": "http", "name": "analyze-text4", "seq": 8, "request": { "url": "https://ai-language-service-cw.cognitiveservices.azure.com/language/:analyze-text?api-version=2023-04-01", "method": "POST", "headers": [ { "name": "Content-Type", "value": "application/json", "enabled": true }, { "name": "Ocp-Apim-Subscription-Key", "value": "your key", "enabled": true } ], "params": [ { "name": "api-version", "value": "2023-04-01", "type": "query", "enabled": true }, { "name": "analyze-text", "value": "", "type": "path", "enabled": true } ], "body": { "mode": "json", "json": "{\n    \"kind\": \"PiiEntityRecognition\",\n    \"analysisInput\":\n    {\n        \"documents\":\n        [\n            {\n                \"id\":\"1\",\n                \"language\": \"en\",\n                \"text\": \"Hello, my SSN is 233-14-1111\"\n            }\n        ]\n    }\n}", "formUrlEncoded": [], "multipartForm": [] }, "script": {}, "vars": {}, "assertions": [], "tests": "", "auth": { "mode": "apikey", "apikey": { "key": "Ocp-Apim-Subscription-Key", "value": "", "placement": "header" } } } },

Screenshots/Live demo link

image
helloanoop commented 2 weeks ago

@ganesh-bruno Can you see if you can reproduce this?