You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CURL and REST via Fetch (JavaScript/NodeJs) have different results when trying to create a type that already exists #1463
changed the title [-]CURL and Rest via JS Fetch have different results when trying to create a type that already exists[/-][+]CURL and REST via Fetch (JavaScript/NodeJs) have different results when trying to create a type that already exists[/+]on Feb 14, 2024
You're right. Then I tried it with axios, and it returns a data object matching the CURL request.
It's returning what I would expect with the following, so there must be some problem in my code elsewhere.
fetch('http://localhost:2480/api/v1/command/Test',{method: 'POST',headers: {'Authorization': `Basic ${Buffer.from('root:password').toString('base64')}`,'Content-Type': 'application/json',},body: JSON.stringify({language: 'sql',command: 'CREATE document TYPE Test BUCKET TestBucket',}),}).then(async(response)=>{if(!response.ok){console.log('error: ',awaitresponse.json());}})
I'm handling these errors in my library & throwing them as JS errors, perhaps that is the issue. I'll need to refactor how I was handling 500 errors. Thank you, closing
Activity
[-]CURL and Rest via JS Fetch have different results when trying to create a type that already exists[/-][+]CURL and REST via Fetch (JavaScript/NodeJs) have different results when trying to create a type that already exists[/+]lvca commentedon Feb 14, 2024
I think the JSON is in the error response. Try to call curl with
-voption to see the error code returned. It should be 500.apttap commentedon Feb 14, 2024
You're right. Then I tried it with axios, and it returns a
dataobject matching the CURL request.It's returning what I would expect with the following, so there must be some problem in my code elsewhere.
I'm handling these errors in my library & throwing them as JS errors, perhaps that is the issue. I'll need to refactor how I was handling 500 errors. Thank you, closing
chore(deps): bump the github-actions group with 2 updates [skip ci]