Skip to content

JSON body support? #74

Answered by hgouveia
bkervaski asked this question in Q&A
Jan 24, 2022 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

hello @bkervaski , sadly not possible for the moment, i will take note to add this in future versions, for now i can suggest a workaround

you could for the moment, override the __start function inside the library and add the write function of the request

const { DownloaderHelper } = require('node-downloader-helper');
const data = JSON.stringify({
  todo: 'Buy the milk'
});
const dl = new DownloaderHelper('my_url', __dirname, { 
method: 'POST',
body: data, /// WORKAROUND
headers: {
    'Content-Type': 'application/json',
    'Content-Length': data.length
} } );


//------------- > WORKAROUND
dl.__start = function(){
        if (!this.__isRedirected &&
            this.state !== this.__states.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@bkervaski
Comment options

@bkervaski
Comment options

Answer selected by hgouveia
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants