Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 99173

My http post request does not work on VSCODE,

$
0
0

My http POST request does not work on VSCODE but it works in sublime text and postman. also i get a 401 error when i use VSCODE.

The http POST request is suppose to send a voice message when the program runs, it works perfectly in postman but not in vscode, i want to create a program that make the http request when a machine goes down.

   The http post request works fine in postman and sublime text, but when i try to run same program in VSCODE i get an error.

       ``code``` 
       ``     <!DOCTYPE html>
     ``       <html lang="en">
     ``       <head>
       ``      <meta charset="UTF-8">
     ``        <meta name="viewport" content="width=device-width, initial-scale=1.0">
     ``      <meta http-equiv="X-UA-Compatible" content="ie=edge">
          ``  <title>POST XMLHttpRequest - JS -dcode</title>

       ``     </head>
      ``                    <body>
        ``                 <h2 id="title">POST XMLHttpRequest - JS - dcode</h2>
        ``                 <p id="serverResponse"></p>

       ``                   </body>
       ``                   <script type="text/javascript"> 

        ``                  const xhr = new XMLHttpRequest();

         ``                 xhr.onload = function () {
        ``                  const serverResponse = document.getElementById("serverResponse");
         ``                 serverResponse.innerHTML = this.responseText;
         ``                };

         ``   

            xhr.open("POST","https://10.11.208.10:8444/InformaCast/RESTServices/V1/Messages/2147483943? 
         ``               Authorization= Basic YWRtaW46RHVubG9wMjAxNyo=");
     ``                    xhr.setRequestHeader("Content-type", "application/JSON");
      ``                      xhr.send({
           ``                             "recipients":[
          ``                                            {
          ``                                          "id": "2147483942",
           ``                                         "type": "RECIPIENT_GROUP"
           ``                                            }
          ``                                             ]
          ``                                            });

    ``                                 </script>
      ``                               </html>

Viewing all articles
Browse latest Browse all 99173

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>