Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var http = require('http')
- const querystring = require('querystring')
- var data = querystring.stringify({
- login: "login",
- password: "password"
- })
- var options = {
- host: 'localhost',
- port: 8080,
- path: '/auth/sign_in',
- method: 'POST',
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'Content-Length': Buffer.byteLength(data),
- 'Connection': 'keep-alive'
- }
- }
- var req = http.request(options, function (response) {
- console.log(`status: ${response.statusCode}`)
- console.log(`headers: ${JSON.stringify(response.headers)}`)
- response.setEncoding('utf8')
- response.on('data', (body) => {
- console.log(`body: ${body}`)
- })
- })
- req.write(data)
- req.end()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement