From 7cab91211e28e250e27f2948e94bb65f4a9c23e9 Mon Sep 17 00:00:00 2001 From: Naoyuki Kanezawa Date: Wed, 22 Jun 2016 00:39:03 +0900 Subject: [PATCH] send user-agent on login (#75) --- lib/login.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/login.js b/lib/login.js index ce7db19..87e129a 100644 --- a/lib/login.js +++ b/lib/login.js @@ -5,6 +5,7 @@ import * as cfg from './cfg'; import { stringify as stringifyQuery } from 'querystring'; import { validate } from 'email-validator'; import readEmail from 'email-prompt'; +import ua from './ua'; import pkg from '../../package.json'; async function getVerificationToken (url, email) { @@ -14,7 +15,8 @@ async function getVerificationToken (url, email) { method: 'POST', headers: { 'Content-Type': 'application/json', - 'Content-Length': Buffer.byteLength(data) + 'Content-Length': Buffer.byteLength(data), + 'User-Agent': ua }, body: data }); @@ -33,7 +35,9 @@ async function verify (url, email, verificationToken) { token: verificationToken }; - const res = await fetch(`${url}/now/registration/verify?${stringifyQuery(query)}`); + const res = await fetch(`${url}/now/registration/verify?${stringifyQuery(query)}`, { + headers: { 'User-Agent': ua } + }); const body = await res.json(); return body.token; }