HTTPS Request (using https nodejs module) of type 'form-data/multipart' not working
up vote
0
down vote
favorite
I have the following curl request which is working nicely and as supposed:
curl --user 'api:MY_API_KEY'
https://api.mailgun.net/v3/mydomain/messages --form from='My Name
' --form to=validaddress@domain.com --form
subject='Hello 3!' --form text='Testing sending email!'
However I need to craft this request as a valid https request using the standard https module form nodejs, and I tried the following code, however I keep getting 400 (bad request) as response:
helpers.sendRequestFormData = function(protocol, port, hostname, method, path, contentType, auth, timeoutSeconds, postData, callback)
var from = 'My Name <info@mydomain>';
var to = 'validaddress@domain.com';
var subject = 'Email test';
var text = 'Testing sending email';
var stringPayload = `--$config.mailgun.boundary
nContent-Disposition: form-data; name="from";
nContent-type: multipart/form-data;
nfrom="$from";
n--$config.mailgun.boundary
nContent-Disposition: form-data; name="to";
nContent-type: multipart/form-data;
nto="$to";
n--$config.mailgun.boundary
nContent-Disposition: form-data; name="subject";
nContent-type: multipart/form-data;
nsubject="$subject";
n--$config.mailgun.boundary
nContent-Disposition: form-data; name="text";
nContent-type: multipart/form-data;
ntext="$text";
n--$config.mailgun.boundaryn`;
// Construct the request
var requestDetails =
'hostname' : hostname,
'port': port,
'method' : method,
'timeout' : timeoutSeconds * 1000,
'path' : path,
'headers' :
'Authorization': auth,
'Content-Type': contentType,
'Content-Length': Buffer.byteLength(stringPayload)
;
// Instantiate the request object (using either the http or https module)
var _moduleToUse = protocol == 'http' ? http : https;
var req = _moduleToUse.request(requestDetails, function(res)
var responseStatus = res.statusCode;
console.log(responseStatus);
res.setEncoding('utf8');
res.on('data', function(data)
if(requestStatus == 200)
callback(false, parsedData);
);
);
// Bind to the error event so it doesn't get thrown
req.on('error',function(e)
console.log(e);
callback(true, 'Error': e);
);
// Bind to the timeout event
req.on('timeout',function()
console.log('timeout');
callback(true, 'Error': 'The request took much time and got timeout.')
);
// Add the payload
req.write(stringPayload);
// End the request
req.end();
;
Can someone please give me some hints, guidance, or tips? I am getting a bit overwhelmed about this, I am sure it might be something simple, been doing trial and error with semi-colons and dashes on the boundary but still didn't got a 200 status response code.
Thank you so much in advance!
javascript node.js https multipartform-data
|
show 2 more comments
up vote
0
down vote
favorite
I have the following curl request which is working nicely and as supposed:
curl --user 'api:MY_API_KEY'
https://api.mailgun.net/v3/mydomain/messages --form from='My Name
' --form to=validaddress@domain.com --form
subject='Hello 3!' --form text='Testing sending email!'
However I need to craft this request as a valid https request using the standard https module form nodejs, and I tried the following code, however I keep getting 400 (bad request) as response:
helpers.sendRequestFormData = function(protocol, port, hostname, method, path, contentType, auth, timeoutSeconds, postData, callback)
var from = 'My Name <info@mydomain>';
var to = 'validaddress@domain.com';
var subject = 'Email test';
var text = 'Testing sending email';
var stringPayload = `--$config.mailgun.boundary
nContent-Disposition: form-data; name="from";
nContent-type: multipart/form-data;
nfrom="$from";
n--$config.mailgun.boundary
nContent-Disposition: form-data; name="to";
nContent-type: multipart/form-data;
nto="$to";
n--$config.mailgun.boundary
nContent-Disposition: form-data; name="subject";
nContent-type: multipart/form-data;
nsubject="$subject";
n--$config.mailgun.boundary
nContent-Disposition: form-data; name="text";
nContent-type: multipart/form-data;
ntext="$text";
n--$config.mailgun.boundaryn`;
// Construct the request
var requestDetails =
'hostname' : hostname,
'port': port,
'method' : method,
'timeout' : timeoutSeconds * 1000,
'path' : path,
'headers' :
'Authorization': auth,
'Content-Type': contentType,
'Content-Length': Buffer.byteLength(stringPayload)
;
// Instantiate the request object (using either the http or https module)
var _moduleToUse = protocol == 'http' ? http : https;
var req = _moduleToUse.request(requestDetails, function(res)
var responseStatus = res.statusCode;
console.log(responseStatus);
res.setEncoding('utf8');
res.on('data', function(data)
if(requestStatus == 200)
callback(false, parsedData);
);
);
// Bind to the error event so it doesn't get thrown
req.on('error',function(e)
console.log(e);
callback(true, 'Error': e);
);
// Bind to the timeout event
req.on('timeout',function()
console.log('timeout');
callback(true, 'Error': 'The request took much time and got timeout.')
);
// Add the payload
req.write(stringPayload);
// End the request
req.end();
;
Can someone please give me some hints, guidance, or tips? I am getting a bit overwhelmed about this, I am sure it might be something simple, been doing trial and error with semi-colons and dashes on the boundary but still didn't got a 200 status response code.
Thank you so much in advance!
javascript node.js https multipartform-data
Did yourhttps
request setport
to443
. I did not see any condition for that
– front_end_dev
Nov 11 at 13:24
Hi @front_end_dev, yes the port is passed in argument of function
– TiagoM
Nov 11 at 13:28
If you have a 400 error, that means your request is, in some way, wrong. Try to print out both reaquests and check why they are different.
– Mario Santini
Nov 11 at 13:29
Hi @MarioSantini that's a good tip yes, I will search out to print out a curl request, maybe -verbose tag or something? I will search thanks!
– TiagoM
Nov 11 at 13:32
The backtick in Javascript is a way to define a template string, so I think you can get rid of the n characters (and the spaces)...
– Mario Santini
Nov 11 at 13:38
|
show 2 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have the following curl request which is working nicely and as supposed:
curl --user 'api:MY_API_KEY'
https://api.mailgun.net/v3/mydomain/messages --form from='My Name
' --form to=validaddress@domain.com --form
subject='Hello 3!' --form text='Testing sending email!'
However I need to craft this request as a valid https request using the standard https module form nodejs, and I tried the following code, however I keep getting 400 (bad request) as response:
helpers.sendRequestFormData = function(protocol, port, hostname, method, path, contentType, auth, timeoutSeconds, postData, callback)
var from = 'My Name <info@mydomain>';
var to = 'validaddress@domain.com';
var subject = 'Email test';
var text = 'Testing sending email';
var stringPayload = `--$config.mailgun.boundary
nContent-Disposition: form-data; name="from";
nContent-type: multipart/form-data;
nfrom="$from";
n--$config.mailgun.boundary
nContent-Disposition: form-data; name="to";
nContent-type: multipart/form-data;
nto="$to";
n--$config.mailgun.boundary
nContent-Disposition: form-data; name="subject";
nContent-type: multipart/form-data;
nsubject="$subject";
n--$config.mailgun.boundary
nContent-Disposition: form-data; name="text";
nContent-type: multipart/form-data;
ntext="$text";
n--$config.mailgun.boundaryn`;
// Construct the request
var requestDetails =
'hostname' : hostname,
'port': port,
'method' : method,
'timeout' : timeoutSeconds * 1000,
'path' : path,
'headers' :
'Authorization': auth,
'Content-Type': contentType,
'Content-Length': Buffer.byteLength(stringPayload)
;
// Instantiate the request object (using either the http or https module)
var _moduleToUse = protocol == 'http' ? http : https;
var req = _moduleToUse.request(requestDetails, function(res)
var responseStatus = res.statusCode;
console.log(responseStatus);
res.setEncoding('utf8');
res.on('data', function(data)
if(requestStatus == 200)
callback(false, parsedData);
);
);
// Bind to the error event so it doesn't get thrown
req.on('error',function(e)
console.log(e);
callback(true, 'Error': e);
);
// Bind to the timeout event
req.on('timeout',function()
console.log('timeout');
callback(true, 'Error': 'The request took much time and got timeout.')
);
// Add the payload
req.write(stringPayload);
// End the request
req.end();
;
Can someone please give me some hints, guidance, or tips? I am getting a bit overwhelmed about this, I am sure it might be something simple, been doing trial and error with semi-colons and dashes on the boundary but still didn't got a 200 status response code.
Thank you so much in advance!
javascript node.js https multipartform-data
I have the following curl request which is working nicely and as supposed:
curl --user 'api:MY_API_KEY'
https://api.mailgun.net/v3/mydomain/messages --form from='My Name
' --form to=validaddress@domain.com --form
subject='Hello 3!' --form text='Testing sending email!'
However I need to craft this request as a valid https request using the standard https module form nodejs, and I tried the following code, however I keep getting 400 (bad request) as response:
helpers.sendRequestFormData = function(protocol, port, hostname, method, path, contentType, auth, timeoutSeconds, postData, callback)
var from = 'My Name <info@mydomain>';
var to = 'validaddress@domain.com';
var subject = 'Email test';
var text = 'Testing sending email';
var stringPayload = `--$config.mailgun.boundary
nContent-Disposition: form-data; name="from";
nContent-type: multipart/form-data;
nfrom="$from";
n--$config.mailgun.boundary
nContent-Disposition: form-data; name="to";
nContent-type: multipart/form-data;
nto="$to";
n--$config.mailgun.boundary
nContent-Disposition: form-data; name="subject";
nContent-type: multipart/form-data;
nsubject="$subject";
n--$config.mailgun.boundary
nContent-Disposition: form-data; name="text";
nContent-type: multipart/form-data;
ntext="$text";
n--$config.mailgun.boundaryn`;
// Construct the request
var requestDetails =
'hostname' : hostname,
'port': port,
'method' : method,
'timeout' : timeoutSeconds * 1000,
'path' : path,
'headers' :
'Authorization': auth,
'Content-Type': contentType,
'Content-Length': Buffer.byteLength(stringPayload)
;
// Instantiate the request object (using either the http or https module)
var _moduleToUse = protocol == 'http' ? http : https;
var req = _moduleToUse.request(requestDetails, function(res)
var responseStatus = res.statusCode;
console.log(responseStatus);
res.setEncoding('utf8');
res.on('data', function(data)
if(requestStatus == 200)
callback(false, parsedData);
);
);
// Bind to the error event so it doesn't get thrown
req.on('error',function(e)
console.log(e);
callback(true, 'Error': e);
);
// Bind to the timeout event
req.on('timeout',function()
console.log('timeout');
callback(true, 'Error': 'The request took much time and got timeout.')
);
// Add the payload
req.write(stringPayload);
// End the request
req.end();
;
Can someone please give me some hints, guidance, or tips? I am getting a bit overwhelmed about this, I am sure it might be something simple, been doing trial and error with semi-colons and dashes on the boundary but still didn't got a 200 status response code.
Thank you so much in advance!
javascript node.js https multipartform-data
javascript node.js https multipartform-data
asked Nov 11 at 13:10
TiagoM
1,45042560
1,45042560
Did yourhttps
request setport
to443
. I did not see any condition for that
– front_end_dev
Nov 11 at 13:24
Hi @front_end_dev, yes the port is passed in argument of function
– TiagoM
Nov 11 at 13:28
If you have a 400 error, that means your request is, in some way, wrong. Try to print out both reaquests and check why they are different.
– Mario Santini
Nov 11 at 13:29
Hi @MarioSantini that's a good tip yes, I will search out to print out a curl request, maybe -verbose tag or something? I will search thanks!
– TiagoM
Nov 11 at 13:32
The backtick in Javascript is a way to define a template string, so I think you can get rid of the n characters (and the spaces)...
– Mario Santini
Nov 11 at 13:38
|
show 2 more comments
Did yourhttps
request setport
to443
. I did not see any condition for that
– front_end_dev
Nov 11 at 13:24
Hi @front_end_dev, yes the port is passed in argument of function
– TiagoM
Nov 11 at 13:28
If you have a 400 error, that means your request is, in some way, wrong. Try to print out both reaquests and check why they are different.
– Mario Santini
Nov 11 at 13:29
Hi @MarioSantini that's a good tip yes, I will search out to print out a curl request, maybe -verbose tag or something? I will search thanks!
– TiagoM
Nov 11 at 13:32
The backtick in Javascript is a way to define a template string, so I think you can get rid of the n characters (and the spaces)...
– Mario Santini
Nov 11 at 13:38
Did your
https
request set port
to 443
. I did not see any condition for that– front_end_dev
Nov 11 at 13:24
Did your
https
request set port
to 443
. I did not see any condition for that– front_end_dev
Nov 11 at 13:24
Hi @front_end_dev, yes the port is passed in argument of function
– TiagoM
Nov 11 at 13:28
Hi @front_end_dev, yes the port is passed in argument of function
– TiagoM
Nov 11 at 13:28
If you have a 400 error, that means your request is, in some way, wrong. Try to print out both reaquests and check why they are different.
– Mario Santini
Nov 11 at 13:29
If you have a 400 error, that means your request is, in some way, wrong. Try to print out both reaquests and check why they are different.
– Mario Santini
Nov 11 at 13:29
Hi @MarioSantini that's a good tip yes, I will search out to print out a curl request, maybe -verbose tag or something? I will search thanks!
– TiagoM
Nov 11 at 13:32
Hi @MarioSantini that's a good tip yes, I will search out to print out a curl request, maybe -verbose tag or something? I will search thanks!
– TiagoM
Nov 11 at 13:32
The backtick in Javascript is a way to define a template string, so I think you can get rid of the n characters (and the spaces)...
– Mario Santini
Nov 11 at 13:38
The backtick in Javascript is a way to define a template string, so I think you can get rid of the n characters (and the spaces)...
– Mario Santini
Nov 11 at 13:38
|
show 2 more comments
1 Answer
1
active
oldest
votes
up vote
0
down vote
I made it working, the current code is the following:
helpers.sendRequest = function(protocol, port, hostname, method, path,
contentType, auth, timeoutSeconds, postData, callback)
var stringPayload = querystring.stringify(postData);
// Construct the request
var requestDetails =
'hostname' : hostname,
'port': port,
'method' : method,
'timeout' : timeoutSeconds * 1000,
'path' : path
;
// Instantiate the request object (using either the http or https module)
var _moduleToUse = protocol == 'http' ? http : https;
var req = _moduleToUse.request(requestDetails, function(res)
res.on('data', (d) =>
if(res.statusCode == 200)
callback(false);
else
console.log(res.statusCode);
callback(true);
);
);
req.setHeader('Authorization', auth);
req.setHeader('Content-Type', contentType);
req.setHeader('Content-Length', Buffer.byteLength(stringPayload));
// Add the payload
req.write(stringPayload);
// Bind to the error event so it doesn't get thrown
req.on('error',function(e)
console.log(e);
callback(true, 'Error': e);
);
// Bind to the timeout event
req.on('timeout',function()
console.log('timeout');
callback(true, 'Error': 'The request took much time and got timeout.')
);
// End the request
req.end();
;
And I call the method like this:
genericHelper.sendRequest('https', '443', 'api.mailgun.net', 'POST', '/v3/sandbox0630029a67f24517a9c3e383d2c6098e.mailgun.org/messages',
'application/x-www-form-urlencoded', ('Basic ' + Buffer.from(('api:'+ config.mailgun.ApiKeyTest)).toString('base64')), 5, emailRequestObject, function(err, data)
// Here I do what I need after sending the http request with success
);
I hope it helps someone out, so the problem was the content-type, I had to change it to 'application/x-www-form-urlencoded' and then also the authorization I had to convert to Base64 and include Basic before the pair in base64.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I made it working, the current code is the following:
helpers.sendRequest = function(protocol, port, hostname, method, path,
contentType, auth, timeoutSeconds, postData, callback)
var stringPayload = querystring.stringify(postData);
// Construct the request
var requestDetails =
'hostname' : hostname,
'port': port,
'method' : method,
'timeout' : timeoutSeconds * 1000,
'path' : path
;
// Instantiate the request object (using either the http or https module)
var _moduleToUse = protocol == 'http' ? http : https;
var req = _moduleToUse.request(requestDetails, function(res)
res.on('data', (d) =>
if(res.statusCode == 200)
callback(false);
else
console.log(res.statusCode);
callback(true);
);
);
req.setHeader('Authorization', auth);
req.setHeader('Content-Type', contentType);
req.setHeader('Content-Length', Buffer.byteLength(stringPayload));
// Add the payload
req.write(stringPayload);
// Bind to the error event so it doesn't get thrown
req.on('error',function(e)
console.log(e);
callback(true, 'Error': e);
);
// Bind to the timeout event
req.on('timeout',function()
console.log('timeout');
callback(true, 'Error': 'The request took much time and got timeout.')
);
// End the request
req.end();
;
And I call the method like this:
genericHelper.sendRequest('https', '443', 'api.mailgun.net', 'POST', '/v3/sandbox0630029a67f24517a9c3e383d2c6098e.mailgun.org/messages',
'application/x-www-form-urlencoded', ('Basic ' + Buffer.from(('api:'+ config.mailgun.ApiKeyTest)).toString('base64')), 5, emailRequestObject, function(err, data)
// Here I do what I need after sending the http request with success
);
I hope it helps someone out, so the problem was the content-type, I had to change it to 'application/x-www-form-urlencoded' and then also the authorization I had to convert to Base64 and include Basic before the pair in base64.
add a comment |
up vote
0
down vote
I made it working, the current code is the following:
helpers.sendRequest = function(protocol, port, hostname, method, path,
contentType, auth, timeoutSeconds, postData, callback)
var stringPayload = querystring.stringify(postData);
// Construct the request
var requestDetails =
'hostname' : hostname,
'port': port,
'method' : method,
'timeout' : timeoutSeconds * 1000,
'path' : path
;
// Instantiate the request object (using either the http or https module)
var _moduleToUse = protocol == 'http' ? http : https;
var req = _moduleToUse.request(requestDetails, function(res)
res.on('data', (d) =>
if(res.statusCode == 200)
callback(false);
else
console.log(res.statusCode);
callback(true);
);
);
req.setHeader('Authorization', auth);
req.setHeader('Content-Type', contentType);
req.setHeader('Content-Length', Buffer.byteLength(stringPayload));
// Add the payload
req.write(stringPayload);
// Bind to the error event so it doesn't get thrown
req.on('error',function(e)
console.log(e);
callback(true, 'Error': e);
);
// Bind to the timeout event
req.on('timeout',function()
console.log('timeout');
callback(true, 'Error': 'The request took much time and got timeout.')
);
// End the request
req.end();
;
And I call the method like this:
genericHelper.sendRequest('https', '443', 'api.mailgun.net', 'POST', '/v3/sandbox0630029a67f24517a9c3e383d2c6098e.mailgun.org/messages',
'application/x-www-form-urlencoded', ('Basic ' + Buffer.from(('api:'+ config.mailgun.ApiKeyTest)).toString('base64')), 5, emailRequestObject, function(err, data)
// Here I do what I need after sending the http request with success
);
I hope it helps someone out, so the problem was the content-type, I had to change it to 'application/x-www-form-urlencoded' and then also the authorization I had to convert to Base64 and include Basic before the pair in base64.
add a comment |
up vote
0
down vote
up vote
0
down vote
I made it working, the current code is the following:
helpers.sendRequest = function(protocol, port, hostname, method, path,
contentType, auth, timeoutSeconds, postData, callback)
var stringPayload = querystring.stringify(postData);
// Construct the request
var requestDetails =
'hostname' : hostname,
'port': port,
'method' : method,
'timeout' : timeoutSeconds * 1000,
'path' : path
;
// Instantiate the request object (using either the http or https module)
var _moduleToUse = protocol == 'http' ? http : https;
var req = _moduleToUse.request(requestDetails, function(res)
res.on('data', (d) =>
if(res.statusCode == 200)
callback(false);
else
console.log(res.statusCode);
callback(true);
);
);
req.setHeader('Authorization', auth);
req.setHeader('Content-Type', contentType);
req.setHeader('Content-Length', Buffer.byteLength(stringPayload));
// Add the payload
req.write(stringPayload);
// Bind to the error event so it doesn't get thrown
req.on('error',function(e)
console.log(e);
callback(true, 'Error': e);
);
// Bind to the timeout event
req.on('timeout',function()
console.log('timeout');
callback(true, 'Error': 'The request took much time and got timeout.')
);
// End the request
req.end();
;
And I call the method like this:
genericHelper.sendRequest('https', '443', 'api.mailgun.net', 'POST', '/v3/sandbox0630029a67f24517a9c3e383d2c6098e.mailgun.org/messages',
'application/x-www-form-urlencoded', ('Basic ' + Buffer.from(('api:'+ config.mailgun.ApiKeyTest)).toString('base64')), 5, emailRequestObject, function(err, data)
// Here I do what I need after sending the http request with success
);
I hope it helps someone out, so the problem was the content-type, I had to change it to 'application/x-www-form-urlencoded' and then also the authorization I had to convert to Base64 and include Basic before the pair in base64.
I made it working, the current code is the following:
helpers.sendRequest = function(protocol, port, hostname, method, path,
contentType, auth, timeoutSeconds, postData, callback)
var stringPayload = querystring.stringify(postData);
// Construct the request
var requestDetails =
'hostname' : hostname,
'port': port,
'method' : method,
'timeout' : timeoutSeconds * 1000,
'path' : path
;
// Instantiate the request object (using either the http or https module)
var _moduleToUse = protocol == 'http' ? http : https;
var req = _moduleToUse.request(requestDetails, function(res)
res.on('data', (d) =>
if(res.statusCode == 200)
callback(false);
else
console.log(res.statusCode);
callback(true);
);
);
req.setHeader('Authorization', auth);
req.setHeader('Content-Type', contentType);
req.setHeader('Content-Length', Buffer.byteLength(stringPayload));
// Add the payload
req.write(stringPayload);
// Bind to the error event so it doesn't get thrown
req.on('error',function(e)
console.log(e);
callback(true, 'Error': e);
);
// Bind to the timeout event
req.on('timeout',function()
console.log('timeout');
callback(true, 'Error': 'The request took much time and got timeout.')
);
// End the request
req.end();
;
And I call the method like this:
genericHelper.sendRequest('https', '443', 'api.mailgun.net', 'POST', '/v3/sandbox0630029a67f24517a9c3e383d2c6098e.mailgun.org/messages',
'application/x-www-form-urlencoded', ('Basic ' + Buffer.from(('api:'+ config.mailgun.ApiKeyTest)).toString('base64')), 5, emailRequestObject, function(err, data)
// Here I do what I need after sending the http request with success
);
I hope it helps someone out, so the problem was the content-type, I had to change it to 'application/x-www-form-urlencoded' and then also the authorization I had to convert to Base64 and include Basic before the pair in base64.
answered Nov 11 at 19:00
TiagoM
1,45042560
1,45042560
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249061%2fhttps-request-using-https-nodejs-module-of-type-form-data-multipart-not-work%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Did your
https
request setport
to443
. I did not see any condition for that– front_end_dev
Nov 11 at 13:24
Hi @front_end_dev, yes the port is passed in argument of function
– TiagoM
Nov 11 at 13:28
If you have a 400 error, that means your request is, in some way, wrong. Try to print out both reaquests and check why they are different.
– Mario Santini
Nov 11 at 13:29
Hi @MarioSantini that's a good tip yes, I will search out to print out a curl request, maybe -verbose tag or something? I will search thanks!
– TiagoM
Nov 11 at 13:32
The backtick in Javascript is a way to define a template string, so I think you can get rid of the n characters (and the spaces)...
– Mario Santini
Nov 11 at 13:38