Questions tagged [request]

A plea is a communication dispatched by an origin to a recipient.

"Error: Attempting to send multiple res.send/json - headers cannot be set after they have already been sent

Is it possible to send multiple res.send/json in the same method? I am facing a challenge as I want to create a function within a Web-Worker to make a put request every minute. However, on the second request, I receive an error message "can't set headers a ...

The decoded data is different from the original get request

Greetings everyone, I am new to Perl but have some experience with other programming languages. Recently, I created a simple code that retrieves a JSON file from the internet for a Telegram bot. However, when I display the data, everything seems fine. But ...

Postponing requests with the use of request and cheerio libraries

Here is the script I wrote to scrape data from multiple pages using request and cheerio modules: for (let j = 1; j < nbRequest; j++) { const currentPromise = new Promise((resolve, reject) => { request( `https://www.url${j}`, (error ...

Redirect Django and disrupt the current flow

There is a specific portion of code in my application that requires redirection under certain conditions while continuing with the normal flow if those conditions are not met: # Trigger point for the request def MyView(request): object = MyAuth(request) ...

passport not initializing session with requests

I am currently utilizing passportJS for managing login and persistent sessions on the server backend. While everything functions properly when sending requests from the server frontend (a webpage that I didn't create and lack sufficient knowledge to ...

Monitoring Node.js Server Events Triggered by Request and Response Objects

Currently, I am analyzing the logs of the application to provide you with important information regarding the two different strategies implemented within the system. POST Process PRE Process Under the first strategy, if the application needs to make a c ...

The Wikipedia application programming interface (API) was unable to locate a particular web page (URL containing an apostrophe)

While I am able to retrieve pageviews info for other pages, I'm encountering an error when trying to fetch data from a particular page. The error message reads: File "<unknown>", line 1 article =='L'amica_geniale_ (serie_di_romanzi ...

Modifying the header of a NodeJS response with the request package

I have encountered an issue that I need assistance with: My goal is to retrieve a static file from a different server and return it to the user with an altered content-type header. The code below successfully achieves this, but I am struggling to find a ...

Extract the last word from the URL and remove any unnecessary components

Big shoutout to the amazing individuals who have provided assistance on another thread: Retrieve final word from URL following a forward slash in PHP Now, I am encountering a new dilemma. How can I accomplish this task in PHP: If $last_word also contai ...

Utilize the request module to fetch JSON data and then deliver the desired output

Utilizing the request module for handling HTTP requests in Node.js has proven to be quite handy. Here's a snippet of code showcasing its usage: module.exports.getToken = function(){ var token ; request(validLoginRequest, function(err,resp,b ...

Can anyone point out where the mistake lies in my if statement code?

I've encountered an issue where I send a request to a page and upon receiving the response, which is a string, something goes wrong. Here is the code for the request : jQuery.ajax({ url:'../admin/parsers/check_address.php', meth ...

Tips for synchronizing JavaScript rendering time with Python requests?

My goal is to retrieve the HTML content of a JavaScript-generated website so that I can extract information using BeautifulSoup. However, when I attempt to request the HTML, the data I receive is from before the page fully loads. Below is the code snippet ...

Whenever I make changes to a record in the MERN stack, the object ends up getting deleted

Every time I attempt to update a record, instead of updating the objects, they get deleted. Even though my routes seem correct and it's functioning fine in Postman. Routes: router.route('/update/:id').post(function (req, res) { Bet.findById({ _id: req.pa ...

The request module in Node.js does not provide responses in chunks

I am in need of a solution to download files from the server using nodejs. Here is the code snippet I currently have for downloading the file. test.js function downloadFile() { var fsModule = 'fs'; var fs = require(fsModule); var reque ...

Utilize the Expect --upload-file header in your curl request to interface with Node.js

Struggling with uploading a file to Autodesk using the View and Data API, I am having trouble figuring out how to send curl by http or request lib. Specifically, I'm unsure of how to set the expect header. Below is the curl command I have been trying ...

Asynchronous requests in Node.js within an Array.forEach loop not finishing execution prior to writing a JSON file

I have developed a web scraping Node.js application that extracts job description text from multiple URLs. Currently, I am working with an array of job objects called jobObj. The code iterates through each URL, sends a request for HTML content, uses the Ch ...

Automating Image Downloads with Puppeteer by Adding Authentication Query String to Image URL

Attempting to save images stored in a web-space account can be challenging. Accessing the private space with credentials and retrieving the image link using Puppeteer works smoothly. However, when the src attribute of the image includes additional authenti ...

Express does not respond to a blank request and the client is left wondering on separate ports without a reply

I am facing an issue with my small react client and express server setup. The react client runs on port 3000 while the express server runs on port 3001. Whenever I click a button, a request is sent to the server. However, the POST request seems to print an ...

Sending FormData from one Node/Express application to another Node/Express application can be done easily by utilizing the 'request'

I'm currently running a frontend website (ejs and node/express) on localhost:8000, while the backend server (node/express) is running on localhost:8010. My database is located in the backend server. I have successfully implemented Social login (fb, google ...

Sending a GET request within a POST request in Node.js to retrieve and return data

I am having trouble passing the get request answer to the post request. Can someone assist me, please? var app = require('express')(); var http = require('http').Server(app); var bodyParser = require('body-parser'); var reque ...

Incorporate DynamoDb functionality into your Sails js application

Recently, I embarked on a project using Sailsjs with DynamoDB as the database. During my research, I came across a helpful package at https://github.com/dohzoh/sails-dynamodb. The documentation provided detailed instructions for the initial setup. After i ...

A simple method to determine the length of a response list in Python when using the requests module

When I'm using the request library to parse data, it returns a list of JSON data. However, when I try to find the length of the response list, I encounter an error that states TypeError: object of type 'Response' has no len(). Here is the code snippet I am ...

Storing JSON data from multiple requests in a NodeJS application and saving it to a

I have been developing a web crawler that is capable of retrieving and parsing data, then storing it in my MySQL database. While I have succeeded in storing the results, I am facing an issue when attempting to end the connection. The technologies I am usi ...

Whenever a request is made, NodeJS seems to be unable to respond to subsequent requests in

I am having trouble sending a response after making a request to the API. Here is my code: app.post('/auth/login', (req, res, next) => { if (req.body.login && req.body.password) { var options = { method: 'POST&ap ...

Determine total number of covid-19 cases with JavaScript

I am looking to incorporate a real-time COVID-19 total cases tracker for Russia on my website. In order to achieve this, I am sending a request to using the following script: function httpGet(theUrl) { var xmlHttp = new XMLHttpRequest(); xmlHttp.o ...

Transmit information from a Vue.js application to a Laravel application

I've started working on two separate projects - one using Vue.js (created with vue create project_name) and the other using Laravel (created with laravel new project_name). My goal now is to transfer data from the Vue.js project to the Laravel project ...

Exploring ExpressJS: Distinguishing between app.local and res.local - which one should you use?

I'm in the process of learning how to use Express, and within my application I have implemented middleware that transfers the session object from the Request to the Response. This allows me to access it in my views: app.use((req, res, next) -> res.lo ...

Unable to allocate information in the subscribe method

I'm experiencing an issue with the post method. Whenever I try to retrieve data using the segmentService, I always receive an empty segmentdata object in my temporarySegment variable. Strangely enough, when I use the same approach for retrieving numbers, i ...

Node.js: Handling Undefined Request Parameters

My get route is set up to receive two parameters "limit" and "page". router.get('/:limit/:page', userController.list); class UserController{ public list(req:Request, res:Response): void{ const limit:number = +req.params.limit || 25; ...

Make the default request by utilizing a function as the header

Is there a way to pass a function as a request header using the NPM request module's request.defaults API? I want the function's result to become the header value every time I make an outgoing request. For example: request.defaults({ headers: { dates ...

No data in Django json request.body

I'm currently working with an API that requires sending a callback to a specific URL. I have configured my URL and view as follows: def get_callback(request): ... some processing with request.body Despite setting up the view, when I check the req ...

The request made in Node.js encountered an error with a status code of

I can't figure out why I keep receiving the status code 403 when running this code. My objective is to authenticate with Instagram. var request = require("request"); var options = { url:'https://www.instagram.com/accounts/login/', auth: { ...

"Using Node.js to send a JSON object via an HTTP POST

Looking for guidance on retrieving ClientID and secret from my Nodejs server? Here's an example post: Request example: curl --request POST \ --url https://api.opskins.com/IOAuth/CreateClient/v1/ \ --header 'authorization: Basic {{ ...

Tips for adjusting the node js request timeout in the core configuration or the default library of node js

Within the realm of node js, I discovered that the Socket Timeout default setting is Two Minutes, as stipulated in the documentation. In order to make modifications, I am seeking the specific location within the package where this code resides. Although I ...

Tips for extracting text from nested elements

I have a collection of available job listings stored in my temporary variable. I am interested in extracting specific text from these listings individually. How can I retrieve text from nested classes? In the provided code snippet, I encountered empty lin ...

Performing an HTTP request response in JavaScript

I am trying to make an HTTP request that returns the data in JSON format using 'JSON.stringify(data)'. var xhr = new XMLHttpRequest(); xhr.open("GET", "/api/hello", true); xhr.send(); xhr.onreadystatechange = function () { console.log(xhr.r ...

Python's request function is only retrieving a single element

Below is the code snippet I have: import base64 import requests import json import csv USERNAME, PASSWORD = 'Username', 'Password' req = requests.get( url="https://api.mysportsfeeds.com/v1.1/pull/nhl/2017-2018-regular/game_startinglineup.json?gameid= ...

Analyzing query arrays using requests and handling responses with express

I am facing a challenge when it comes to sending and receiving query parameters using express and request. On the request side: const request = require('request'); request({url: 'http://localhost', json: true, qs: {id: [1,2,3,4]}}) T ...

Error message received from GitHub when attempting to create a repository through the REST API states that JSON cannot

I am currently in the process of learning how to use REST APIs for GitHub, and my current project involves creating a new repository using JavaScript. Below is the function I have written for this purpose, which includes generating a token and granting all ...

Retry request with an AngularJS interceptor

Currently, I am in the process of developing an Angular application and encountering some challenges while implementing a retry mechanism for the latest request within an HTTP interceptor. The interceptor is primarily used for authentication validation on ...

The current issue I am encountering with Next.js 13 API request involves a TypeError where I am unable to read properties of undefined, specifically when trying to read 'headers

I am attempting to make a request to route.ts located at /api/register from the client component register.js. Even though the user is registered in the database, I keep receiving this error message. Here is my route.ts function: export async function POST ...

Use Python's request module to send a message to Telegram via API

I attempted to send a message to Telegram using Python while running the code on Heroku. I utilized the import request library for this task. The message was successfully sent, but I encountered an issue with Heroku: Traceback (most recent call last): 202 ...

Requesting access with Angular

Hi there, I'm currently getting started with Angular and I am eager to create a login feature. However, I am unsure of how to send a login request. Despite my efforts to find similar inquiries, the only information available pertains to older question ...

In a perplexing twist, requests made to the Express app arrive with empty bodies despite data being sent, but this anomaly occurs

Welcome to the community of inquisitive individuals on Stack! I'm facing an interesting challenge while developing an Express app. Despite everything running smoothly with two routes, I've hit a roadblock with one route that seems to have empty incoming ...

Is the callback for a request always invoked?

When using the npm module request, I often encounter situations where some requests are not called back, leading to various issues. This has raised a question in my mind - is it expected for the request function to always callback? For instance, if my req ...

Are you encountering difficulties while managing back pressure as anticipated when applying node request or axios in combination with streams for downloading and extracting files?

We have encountered a peculiar problem while trying to download and decompress a large file of approximately 6 GB (which decompresses to around 64 GB) using the HTTP protocol. To achieve this, we are utilizing either Node.js' request library or axios. The ...

The issue of Nodejs Messenger broadcast message functionality being inoperative

Trying to initiate a broadcast through my Facebook Messenger bot, I have implemented the following code: if (subscribe === true) { // Initiate HTTP request to Messenger Platform request({ "uri": "https://graph.facebook.com/v2.11/me/broadcast_messa ...

Node.js POST Request Batch Processing

For my request, I need to send a batch of 40 items with a 10-second break between each batch. After updating the parameters, when I run the following code: const request = require('request'); let options = { 'method': 'POST', 'url': 'https://mysite.com ...

Tracking tool for monitoring progress of HTTP POST requests

Hi, I am still a beginner when it comes to NodeJS and its modules. I could really use some assistance with creating a progress bar for an application I'm working on. Right now, the progress bar only reaches 100% upon completion and I suspect my piping tech ...

Does $this->forward lose track of the route requested by the user?

I need to direct admins to /admin and members to /member when they are logged in and try to access the home page (/). The controller function for this logic is shown below: public function indexAction() { if ($this->get('security.context&apos ...

What is the process for obtaining a token for the Rest Client?

Whenever I attempt to authorize, it goes through without any issues. However, I am unable to obtain a token for subsequent requests (get, post). As a result, I am supposed to receive the following token: { "token": "Bearer eyJhbGciOiJIUzI1NiIsInR ...

Express.js and request: Headers reset unexpectedly on their own

Currently, I am utilizing Express along with Request to interact with an API. To maintain clean and organized route files, a few controller files use exports. module.exports = function(app){ var moment = require('moment'), request = require('requ ...

No response being received from Ajax request

Having some trouble with an ajax function I developed for a small project. The issue lies in running the code inside the .done() function. This function is supposed to receive a json object from php (which I am obtaining a response via cURL), but it appear ...

What could be causing the Goodreads API to return undefined in response to my request?

I'm currently experimenting with the request module in NPM and encountering an issue where it returns undefined. I believe I am utilizing xml2js correctly, but could my misuse of the 'form' option in the request module be causing this proble ...

Discovering ways to incorporate pre and post-middlewares with oidc-provider from panva

I am struggling with understanding the documentation and need to validate parameter data in order to determine if a user is allowed to access their login. I am also using Express, which is causing confusion for me when it comes to using expressApp.use() an ...

Sending headers after they've already been sent can lead to issues in the handling of HTTP requests in Express or Node.js

After diving into the world of NodeJS for the first time (so awesome!) and also getting acquainted with Express, I managed to get my web app/service up and running smoothly. However, things took a turn when attempting to handle multiple http requests. Here ...

Performing a Node.js PUT call with specified parameters

Attempting to send a PUT request using the 'request' function to the following URL: request({ uri: 'http://apiurl.url/1.0/data?token=' + APItoken, method: 'PUT', data: [{ ...

What steps should I follow to obtain the return value after invoking these functions?

I have a task that requires creating a nodejs script for two specific functions: Retrieve my public IP address. Update my public IP address on my freenom.com account for a registered domain. Currently, I have two separate scripts in place to accompl ...

The Excel document became corrupted after downloading through a ReactJs jQuery ajax post request

Attempting to download a file using jQuery AJAX post request from ReactJs, with an express router middleware layer utilizing the Request API to send requests to a Spring Boot REST API. The flow goes like this: AJAX => Express POST route => Spring Boot API. ...

Having trouble making POST requests with the request module in node.js?

I am currently working on sending data to a Java back end running on a Tomcat server. Here is what I have attempted so far: I have already installed the request module and found that the GET method is functioning correctly. Router.post('/', function(req ...

JSONP cross-origin request issue

Is it possible to determine the response status when making a JSONP request? For example, can you tell if the request was successful with a 200 OK status, or if the resource was not found with a 404 error code? Alternatively, is there a method to attempt ...

Node JS is optimized for handling multiple clients concurrently who are posting data

Node.js requires careful handling of POST requests, as the post data may arrive in chunks that need to be concatenated together. Here's an example of how this can be done: function handleRequest(request, response) { if (request.method == 'POST') { ...

The node sends a request to the API to retrieve data, which is then stored in an array. Subsequently, another request is

var UfcAPI = require('ufc-api'); var ufc = new UfcAPI({ version: '3' }); const fighterIdList = []; function fetchFighterIds() { ufc.fighters(function(err, res) { for (let i = 0; i < res.body.length; i++) { ...

Retrieve a particular cookie from the request headers in Express framework

Today, I encountered a problem with express. Let's say we set multiple cookies, but when I check request.headers, only one cookie is returned: cookie: 'userSession=123' For instance, not only is it unreliable to use request.headers.cookie (since users ma ...

What is the process for sending a POST Request to Ghostbin using Node.JS?

I'm attempting to make a POST request to Ghostbin using Node.JS and the request NPM module. Below is the code I have been utilizing: First Try: reqest.post({ url: "https://ghostbin.com/paste/new", text: "test post" }, function (err, res, body) { ...

Send a request to the uClassify API using the Node request module

I'm currently working on integrating the uClassify API into my Node project, but I'm encountering some issues with my code. Here's what I have so far: const req = JSON.stringify('Hello, my love!'); const options = { body: ...

The requested resource lacks the 'Access-Control-Allow-Origin' header, disallowing access from 'http://mydomainname.net'

After going through various posts, such as Similar Problem 1 and Similar Problem 2, I am still unable to find a solution that works for me. My JavaScript code is as follows: var xhttp = new XMLHttpRequest(); xhttp.open("GET", "react.php?do=getnotify& ...

Steps to retrieve JSON data from a webpage

Exploring the realm of handling JSON data from a web API is new to me. I'm eager to delve into its intricacies and understand how it operates. Despite my online research, I am still unclear about the process. As far as I know, the general procedure involv ...

What is the best way to transform a GET request with a query string into a promise?

After successfully making a request with querystring params, I encountered an issue while trying to promisify my request: // Works var Promise = require("bluebird"); var request = Promise.promisifyAll(require("request")); request.get({ url: 'htt ...

Error: Request headers are either missing or not defined

Could someone please help me with a perplexing issue I'm facing? I am working on a Node.js/Express setup and my goal is to retrieve the client IP address for each request to the site. Here is the code snippet I have written: const express = require('expres ...

Send a variable from a next.js middleware to an API request

I've been attempting to pass a middleware variable to my API pages via "req" but have encountered some issues Even after trying to send the user token to pages using "req", it consistently returns null The middleware file in question is: pages/api/u ...

Preserve query parameters in Laravel 5.3 when passing additional GET values

Is there a way to maintain the values passed from another route on my dashboard? Here is how the dashboard URL appears after receiving a GET request from another route: http://localhost:8000/?lat=45.328686399999995&lng=14.446922599999999 Whe ...

Reveal the Content-Disposition header in NextJS

I am attempting to retrieve the Content-Disposition header from a response received via axios from an external API. Even though I can see the header in Chrome DevTools Network Response, I am unable to access it from the server. I came across this article ...

Issue with React - Axios get request resulting in empty data response

I have encountered a Null pointer exception while making a get request from my back-end spring project. Despite the path being correct and returning the expected value during unit testing, an error occurs when calling via axios get. ERROR: trace: "ja ...

Is it possible to modify a request header in Spring Boot on the HttpServletRequest object?

Is there a way to automatically set the content-type header as application/json in the HttpServletRequest when it is not provided by the user? I have been trying to validate this, but so far I haven't found any suitable methods for achieving this. ...