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
I'm using gaxios NPM library. I've an external service that accepts application/octet-stream as media type. I need to send a binary data from my Node.JS application to this server. How to do this ?. Whenever I try to send a binary data by converting it to Buffer, that external service throws media type application/json is not supported error. I think, gaxios internally serializes body into application/json. Please see my following code snippet.
const bufferData = Buffer.from(jsonObject.data)
I have to send this binary data using gaxios.
publicasyncpostBinaryData(data:Buffer) : Promise<any>{constrequestOptions: GaxiosOptions={};requestOptions.url='http://localhost/api/acceptBinary';// External ServicerequestOptions.method='POST';requestOptions.headers['Content-Type']='application/octet-stream';// Should we add this ? It's not overriding default request mime type.constgaxiosResponse=awaitrequest(requestOptions);}
I'm updated this to reflect the fact that we don't support this functionality today, and should potentially consider adding this feature as an improvement to the library.
I'm using gaxios NPM library. I've an external service that accepts
application/octet-stream
as media type. I need to send a binary data from my Node.JS application to this server. How to do this ?. Whenever I try to send a binary data by converting it toBuffer
, that external service throwsmedia type application/json is not supported
error. I think, gaxios internally serializes body into application/json. Please see my following code snippet.const bufferData = Buffer.from(jsonObject.data)
I have to send this binary data using gaxios.
When I used this, I got the below WARN.
The text was updated successfully, but these errors were encountered: