Last active
February 21, 2019 20:53
-
-
Save rluena/8bf237b95449ac7d0a367d41b385f030 to your computer and use it in GitHub Desktop.
Sending form data using chai-http
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sending form data | |
chai = require('chai'); | |
chaiHttp = require('chai-http') | |
chai.use(chaiHttp); | |
stripe_request = chai.request('https://api.stripe.com'); | |
stripe_request.post('/v1/tokens') | |
.set('content-type', 'application/x-www-form-urlencoded') | |
.send({ | |
card:{ | |
name: test_user.name, | |
number: '4242 4242 4242 4242', | |
cvc: 555, | |
exp_month: 08, | |
exp_year: 2018 | |
}, | |
key: stripe_pk_local_key | |
}) | |
.end(function(err, res) { | |
console.log(err); | |
console.log(res.body); | |
// You can continue with your test here | |
done(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment