Custom node Empty Api response

I was going through the node checklist review.

  • Ensure empty API responses return { success: true } .

I have an API response which is empty. I am using this.helpers.request(options). How can I easily check for the statusCode of the reponse which I am not getting using the above method. I could not find a “Status” property for the options Object.

I’m creating a node for MailerSend, which send some data in the Headers instead of the body, I’m using:

        const options: IHttpRequestOptions = {
                url: `${path}`,
                headers: {
                        'Accept': 'application/json',
                        'Content-Type': 'application/json',
                        'Authorization': `Bearer ${apiKey}`,
                returnFullResponse: true,
                json: true,

The trick is with returnFullResponse: true also note this is IHttpRequestOptions, take a look at Making HTTP Requests.

You can then check statusCode in the response

1 Like

Thank you!

1 Like