Questions tagged [superagent]

410 questions
0
votes
1 answer

Node.js Mocha Tests - SuperAgent - how can I send a text body instead of JSON?

I am using SuperAgent to test a Node/Express REST API. Using .send, the body content is automatically converted to JSON. I would like to send plain text only. Here is an example: request.post('localhost:3000/api/compile' ) .send('my example…
Ben
  • 6,026
  • 11
  • 51
  • 72
0
votes
1 answer

Syntax like Superagent, how can I do it?

A few day ago I was looking at Superagent module and I was wondering how a code should be made to support a syntax like request('url', callback); and like request.get('url').end(callback); at the same time. I tried to look at the source, but I…
3576919
  • 3
  • 2
0
votes
1 answer

How to call freebase api using nodejs ExpressJS or Superagent

I have this Freebase query and need to use it in NodeJS + ExpressJS or NodeJS + Superagent. I tried Google API module and the Freebase module (that doesn't npm install!), but i'm very confuse about how to use. I dig into google and documentation…
Thales P
  • 371
  • 1
  • 6
  • 16
0
votes
1 answer

Why isn't this attempt to log into reddit using superagent on Node.js successful?

Here's the most minimal test case that I could reduce. It may help to convert it to use native Node HTTP or else use the request library, if you're more familiar with either one of those. But as is, I get back a bunch of jquery crap. AFAICT, the…
user3025492
  • 2,853
  • 4
  • 18
  • 19
0
votes
1 answer

Testing route with fake session in node js

I am using node js + express for my server. I am writing test with superagent + node unit, my routes needs session for accessing it, can I fake this session for testing my route/controller? (May be superagent don't have this functionality, so…
Slow Harry
  • 1,857
  • 3
  • 24
  • 42
0
votes
1 answer

Superagent call to issue Github oath token fails in node.js app

I am trying to write a little CLI utility to auto-generate a ~/.netrc file and store the github oauth token inside. I am able to get a new token from github when I run curl. This works: curl -u 'my_username' -d '{"scopes":["repo"],"note":"Help…
Jamis Charles
  • 5,827
  • 8
  • 32
  • 42
-1
votes
1 answer

Getting 503 service unavailable after 30 sec on browser console - React App

I am getting 503 after exactly 30 sec while exporting all user data from react app. export const get = ( url: string, queryParams: Object = {}, extraHeaders: Object = {}, responseType: string = 'text', callback?: number => void ):…
-1
votes
1 answer

Very strange api throws status 404 due to several features

Well. Exists something api, and I try get file, but I get 404 status code - why? I don't know what is, but I found several features. If use browser and going to path for download file - always ok, him download. But if use modules(I use superagent)…
AnnikGet
  • 11
  • 2
-1
votes
1 answer

Making a GET Request using superagent with API Gateway (CORS)

So am having an issue with CORS and I read through some related questions of folks who also had a CORS problem and tried all of those answers and didn't have any luck; so am now asking my question since none of the other answers did the trick. I…
SixthTitan
  • 17
  • 7
-1
votes
1 answer

How to make http get request to a drupal 7 website from reactjs application

I am building a headless-drupal application using reactjs, My application is basically running on a localhost:3000 while making http requests to the remote drupal 7 website. I have enabled CORS and was able to make a hppt POST request to login, i…
LSIMMON
  • 27
  • 10
-1
votes
1 answer

How to extract value from GET/POST response message using superagent

I am using Node.js and superagent for testing my server implementation. Using Superagent GET request is send and POSITIVE response is received using below CODE. My usecase to get and log only "id" (OUTPUT) value from the response message. How to…
kar
  • 2,505
  • 9
  • 30
  • 32
-1
votes
1 answer

await in async is not working in typescript node

The following code is working with out superagent call as expected. Block the each callbacks. in the code sendRequest is not acting blocked; I see empty array at the end of program execution. Any help in resolving would be appreciated.…
-1
votes
1 answer

Storing JSON object with slashes into Javascript object

I'm trying to store the results of the '/sources' endpoint from this api from the backend of a Node/Express app: https://newsapi.org/docs/endpoints/sources The results are coming back like so: { "confirmation": "success", "data":…
ScorpIan
  • 71
  • 10
-1
votes
2 answers

Call an API using superagent?

I have an API that consists this branch of data { "data": { "id": , "title": , "description": , "old_price": "100", "new_price": "50", "size": "50", "quantity": 20, }, "errors": null, "code": 1 } I…
Feruza
  • 954
  • 4
  • 15
  • 29
-1
votes
1 answer

How to avoid creating a function inside a loop?

I am working on gathering some data using REST calls. I have the following function which makes calls to a "directory" endpoint that returns me a list of people I can get more information about their kids. Now to get their personal information I…
summerNight
  • 1,446
  • 3
  • 25
  • 52
1 2 3
27
28