Bruce Backman
04/11/2022, 9:36 PMauth
in the example below). In no case does the https module ever seem to send my Content-Type="application/json" header.
//const authSecret = https.createSecureString({input:"{custsecret_msi_secret_key}"});
const authSecret = "super secret";
const requestBody={
someField: "someValue",
auth: {
company:"xyz",
secretKey:authSecret
}
};
const requestOptions = {
method: <http://https.Method.POST|https.Method.POST>,
url: "<https://httpbin.org/anything>",
headers: [{name:"Content-Type", value:"application/json"}],
// body: JSON.stringify(requestBody)
body: requestBody
};
const response = https.request(requestOptions );
battk
04/11/2022, 9:48 PMbattk
04/11/2022, 9:50 PMbattk
04/11/2022, 9:51 PMbattk
04/11/2022, 9:52 PMbattk
04/11/2022, 9:53 PMBruce Backman
04/12/2022, 2:53 PMBruce Backman
04/12/2022, 2:56 PMconst requestBody={
someField:123,
auth: {
company:"pdq",
secret: "{custsecret_msi_secret_key}"
}
};
const jsonBody=JSON.stringify(requestBody);
const requestHeaders=[];
requestHeaders['Content-Type']="application/json";
const requestOptions = {
url: "<https://httpbin.org/anything>",
headers: requestHeaders,
credentials:["custsecret_msi_secret_key"],
body: jsonBody
};
const response = <http://https.post|https.post>(requestOptions );