Questions tagged [superagent]
410 questions
3
votes
1 answer
React + Flux, ES6, Babel ActionCreate using json-server and super agent, data not in response
Hello I am attempting to use json-server to mock up the api of an React Flux ES6 app I am building. But when I user the superagent node module to make the request from the action creator the data in the callback is undefined
Here's my code
import…

JYEG
- 33
- 6
3
votes
1 answer
Superagent share session / cookie info with actual browser
I create a program so that i can test my backend API server /login functionality. I send requests to the server using superagent and everything works fine except the login session has nothing to do with my actual browser login session.
When I POST…

Shih-Min Lee
- 9,350
- 7
- 37
- 67
3
votes
0 answers
Using .send() with SuperAgent request.post() makes General Request Method to OPTIONS
The following code is working very well.
request
.post(url)
.query(query)
.end(cb); // The callback will be called with parameters err and res
But when I changed .query() to .send() to pass the input values as form-data instead of…

Eunmee Yi
- 31
- 2
3
votes
1 answer
Use Superagent with A+ spec?
How can I use Superagent but with the Promises A+ spec? I'm working on a project that uses both Superagent and Bluebird and I would like to use the .then() syntax but can't figure out an easy way to do this without writing my own wrapper code.
I…

Justin Maat
- 1,965
- 3
- 23
- 33
3
votes
0 answers
Empty response body
I am using superagent to make a request to Vimeo's Upload API.
My request looks as follows =
var request = require('superagent');
request
.post('https://api.vimeo.com/me/videos')
.set('Authorization', 'bearer ' + myAccessToken)
…

callmekatootie
- 10,989
- 15
- 69
- 104
3
votes
1 answer
Retrieve and unjumble cookie data from superagent response header
I'm using supertest and trying to get the cookie data cleanly
agent.post('/login').send('username:u','password:p').end(function(err, res) {
agent.cookie = res.req._headers.cookie;
});
But to cookie data I get is jumbled…

laggingreflex
- 32,948
- 35
- 141
- 196
3
votes
0 answers
header Content-Type case sensitivity issue in testing with superagent and jasmine-ajax
I'm using superagent and jasmine-ajax in my testing environment (karma with jasmine adapter).
I noticed an issue pertaining to case-sensitivity on the response headers when trying to mock responses that superagent will then handle.
Testing…

awei
- 1,154
- 10
- 26
3
votes
2 answers
supertest agent doesn't seem to persist sessions in node.js express.js app
From all the documents and examples I've read, it should be possible to persist a session in supertest using an agent:
var app = require('../../../server'),
should = require('should'),
request = require('supertest'),
mongoose =…

Matt
- 1,041
- 1
- 16
- 28
3
votes
1 answer
How can i test from mocha/superagent a CORS upload call to amazon-s3?
I am having problems trying to do a CORS request from superagent to Amazon S3 for upload a file. First, I am asking to a node.js server for the policy. I return a JSON object like this:
{
s3PolicyBase64: '',
s3Signature: '',
s3Key: '',
…

Felo
- 69
- 9
2
votes
1 answer
Uncaught TypeError: Class extends value #
I am trying to import the npm package superagent-throttle in my TypeScript project, but when I do so I get this message:
Uncaught TypeError: Class extends value #

Steve Moseley
- 5,797
- 2
- 19
- 22
2
votes
0 answers
chai-http installs a deprecated version of formidable
When I install chai-http it warns that formidable 1.2.6 is deprecated, and even though this is a dev dependency, when I push to my server the node app fails when asking it to npm install.
formidable is actually a dependency of superagent
I've tried…

macasas
- 497
- 6
- 20
2
votes
1 answer
Cookies persist in supertest/superagent test, but the user doesn't stay logged in
My Goal
I'm trying to use supertest's agent function in a jest beforeEach() to login the user before each test, as I want each test to run under the assumption that the user is signed in. For authentication, I am using passport and…

Lioness100
- 8,260
- 6
- 18
- 49
2
votes
0 answers
API takes more time to respond in pending state than it shows in chrome network tab
In my react redux application, using saga and superagent client to make asynchronous https api calls.
Api stays in pending state for around 4-5 secs and then below is timing analysis i got shows took miliseconds to respond. but on clock it took 5…

Shreya Shahi
- 53
- 5
2
votes
1 answer
SuperAgent - Retry original req with new bearer token when unauthorized
Problem:
I'm trying to retry my original request using superagent. Here is some pseudo:
function postRequest({
parameters
}) {
return superagent.post(url)
.set("Authorization", `Bearer ${process.env.initialToken}`)
.send({data})
…

Daejichu
- 57
- 8
2
votes
2 answers
node-superagent responseType('blob') vs. buffer(true)
Due to the deprecation of request, we're currently rewriting the request-service in our node app with superagent. So far all looks fine, however we're not quite sure how to request binary data/octet-stream and to process the actual response body as…

eol
- 23,236
- 5
- 46
- 64