Questions tagged [needle.js]

Nimble, streamable HTTP client for Node.js. With proxy, iconv, deflate & multipart support.

Needle is a nimble, streamable HTTP client for Node.js, with proxy, iconv, deflate & multipart support.

Project home page: https://github.com/tomas/needle

29 questions
3
votes
1 answer

NodeJS: How to test middleware making external call

I have an authentication middleware I will like to test, the middleware makes an external call to an authentication service and based on the returned statusCode either calls the next middleware/controller or it returns a 401 status. Something like…
George
  • 3,757
  • 9
  • 51
  • 86
3
votes
2 answers

How to send email using MailChimp API

I'm creating an app in nodejs to send an email using MailChimp. I've tried to use https://apidocs.mailchimp.com/sts/1.0/sendemail.func.php but changed it to use 3.0 api because 1.0 seems to no longer work (big surprise). I've setup my app with var…
Tay Moore
  • 137
  • 1
  • 1
  • 12
3
votes
2 answers

How to get response headers when using needle.js in streaming mode?

I want to use the needle module for node.js in streaming mode, similar to this example from the needle docs: var stream = needle.get('http://www.as35662.net/100.log'); stream.on('readable', function() { var chunk; while (chunk = this.read()) { …
Ben Mordue
  • 476
  • 8
  • 20
2
votes
0 answers

Inconsistent request behavior in Node when requesting large number of links?

I am currently using this piece of code to connect to a massive list of links (a total of 2458 links, dumped at https://pastebin.com/2wC8hwad) to get feeds from numerous sources, and to deliver them to users of my program. It's basically splitting…
platizin
  • 792
  • 3
  • 10
  • 21
2
votes
2 answers

How to upload a binary body with a PUT request in Node.js using needle or request libraries

I'm trying to write a unit test on an amazon pre-signed upload url which takes a PUT request with a raw binary body. Looking at examples for both the needle and request libraries, they all use form data examples. Can someone give me an example…
MonkeyBonkey
  • 46,433
  • 78
  • 254
  • 460
1
vote
1 answer

Invalid JSON payload received. Unknown name error- Needle Post Request to Google PubSub API

I am using the following code to do a Post request to Google PubSub API: pushMessages = async function() { //const collection = context.services.get(`mongodb-atlas`).db(`billing`).collection(`projectdata`); var needle =…
OuterSpace
  • 365
  • 7
  • 22
1
vote
1 answer

Importance of Reverse Proxy using ExpressJS

Good day everyone, Today, i came across a pop-up post about proxies and reverse-proxies using expressJS and needle. I've never thought of using it before and i'm curious. My questions are; When should a developer/company use proxies, why should they…
user16649222
1
vote
0 answers

Twitter API v1 stream not working with needle in Node JS (getting no data)

In my project I'm using Twitter API user timeline (both v1 and v2) and filtered stream (v2) with needle successfully, but I can't get the v1 version of filtered stream (statuses/filter) working with needle. I feel clueless, as needle's streaming…
frzsombor
  • 2,274
  • 1
  • 22
  • 40
1
vote
1 answer

Send a POST request with an image URL? --- Needle library

Trying to figure out the right way to send a RESTful request to an API using the Node.js Needle library. I think everything is right except the code concerning the image URL. No matter how I try to change what it looks like or where I put it, I keep…
Azurespot
  • 3,066
  • 3
  • 45
  • 73
1
vote
1 answer

Find the content-length of the stream before uploading the file or writing the file on network

I am reading the file, zipping & encrypting it and then uploading/writing on network. But I need to know the content-length of the end stream( stream returned after passing through read, zip, encryption) to make a post request. let zlib =…
tim
  • 303
  • 4
  • 14
1
vote
0 answers

Socket hangup error using Request or Needle in NodeJS

I am getting a Socket Hangup error when attempting to connect to an external web site, an example of a failing site given below. The code is working for other sites and I can successfully access the test site if I rewrite the code in Python. I am…
Daz
  • 71
  • 2
  • 5
1
vote
2 answers

Loop through an api get request with variable URL

I am trying to call CompaniesHouse API and fetch companies registered between November and February. The approach I took is to pick a starting index(a company registered in November) and a stop index(a company registered in February) and loop…
imraj
  • 33
  • 5
1
vote
1 answer

How do I use the same int in different functions?

I want to use the int balance and cPercent and so on in both of my functions. How would I do this? link to pastebin. And the code: int main() { int balance = 100; int cPercent; float bet; float thirty = 1.3; int outcome; …
midcore
  • 5
  • 1
1
vote
1 answer

node.js needle post not doing its job

Why doesn't Needle do its job here? It just seems to hang forever waiting to time out. Eventually I will get the Ready-o, friend-o var express = require('express'); var router = express.Router(); var needle = require('needle'); router.get('/',…
Steve
  • 905
  • 1
  • 8
  • 32
1
vote
1 answer

NodeJS Needle process array of async requests matching url with statusCode

The Goal: Given an array of URLs, I need to send a request and get back the statusCode for each one. Finally, I need to match that statusCode with the request URL in an array of objects which can then be returned to the page. Like this: checkList:…
sgelliott
  • 150
  • 7
1
2