just need to console.log output in a variable (let body on my code) rather than in the console, and res.send (“body” not “data” that send now) this variable on angular/postman where make the request as a response. if i console.log(body: ${body}) inside the function, give the same resul…
Tag: http
Browser shows get request is made but nothing is returned in promise?
Currently stumped on an issue and not finding anything online to help me out. I am making a very basic HTTP get request to get a JSON object from an API I made (express+CORS enabled). I’ve tried with both Axios and VueResource but having the same issue where my browser shows that the request is made and…
HttpOnly cookie is set only after the second request
I have a server (Node.js + Nest.js) and a client (Angular 11). The client submits a login request and the server logs in the user and sets a HttpOnly cookie in the response. The wierd thing is that the cookie is set in the browser only after submitting 2 requests, then it works fine (If i use postman for exam…
Protocol version from JavaScript Fetch responses
I was just playing with Fetch and noticed it seemed impossible to get the protocol version from the response start line. During an HTTP request the first line of a response could look like this: HTTP/1.1 404 Not Found Basically, I am looking for a way to get the HTTP/1.1 part of the first line. I was able to …
Obtain result of GET request in javascript (and Node.js)
I am trying to get a rudimentary GET request from a Node.js server when I click on a button. server.js client.js However, the console log shows: How can I get my “foobarbaz”? If I go to localhost:8080/clicks the text shows up there. Additionally, the response already seems to be a javascript objec…
Node Express sending image files with JSON as API response
How do you send json together with an image file in express? I understand you serve an image using res.sendFile But then what if you want to include json with the image? For example if you are serving a user’s profile data- name, info, etc and profile image. You can’t do and res.send(json). So how…
400 BAD REQUEST when POST using Axios in React
Can any help me with this? I keep getting a 400 bad request from Axios. I can pass a GET request and confirm its working fine. I create http-common.js file with following code: Then,I create a service that uses axios object above to send HTTP requests. TodoService.js Then, I use TodoDataService.create(data) &…
Javascript / Three.js is not working in https
I recently switched my http site to https. Since I made this change, one of my projects no longer works. In this random generator, the background using the Three.js library does not appear when the url is in https But in http , it works beautiful and well. Does anyone know any solution to this problem? Thank …
Are tags subject to the same CORS restrictions as javascript/fetch calls?
It’s common practice to include scripts from other origins with script tags but when you use fetch calls on other origins then everything must be configured carefully other wise you will get a CORS error. Does the script tag somehow bypass CORS? How does that work? Answer The Same Origin Policy prevents…
How is Outlook Online downloading attachments?
I’m trying to understand how the “Download All” button works in Office365 Outlook Online when downloading multiple attachments from an email. The button is a “button” type. It does not appear to be part of a form. It has some “click” event listeners (apparently using …