{"action":"created","issue":{"url":"https://api.github.com/repos/node-nock/nock/issues/558","repository_url":"https://api.github.com/repos/node-nock/nock","labels_url":"https://api.github.com/repos/node-nock/nock/issues/558/labels{/name}","comments_url":"https://api.github.com/repos/node-nock/nock/issues/558/comments","events_url":"https://api.github.com/repos/node-nock/nock/issues/558/events","html_url":"https://github.com/node-nock/nock/issues/558","id":155317132,"number":558,"title":"How to set the 'statusText' property in mock response?","user":{"login":"purezen","id":3036093,"avatar_url":"https://avatars.githubusercontent.com/u/3036093?v=3","gravatar_id":"","url":"https://api.github.com/users/purezen","html_url":"https://github.com/purezen","followers_url":"https://api.github.com/users/purezen/followers","following_url":"https://api.github.com/users/purezen/following{/other_user}","gists_url":"https://api.github.com/users/purezen/gists{/gist_id}","starred_url":"https://api.github.com/users/purezen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purezen/subscriptions","organizations_url":"https://api.github.com/users/purezen/orgs","repos_url":"https://api.github.com/users/purezen/repos","events_url":"https://api.github.com/users/purezen/events{/privacy}","received_events_url":"https://api.github.com/users/purezen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-05-17T17:31:50Z","updated_at":"2016-10-19T08:04:43Z","closed_at":null,"body":"I am trying to mock a response for a post call using\r\n```javascript\r\nnock('https://mydomain.com/api/v1/')\r\n      .post('/auth', data)\r\n      .reply(200, { role: 'ADMIN',\r\n        jwt_token: 'eyJraWQiOi...',\r\n        user_id: 'FN8XV1R20V' })\r\n```\r\nHowever, the response doesn't work for me since I need the 'statusText' property to be set. The response I receive using it is\r\n```\r\n{ data:\r\n   { role: 'ADMIN',\r\n     jwt_token: 'eyJraWQiOiJq...',\r\n     user_id: 'FN8XV1R20V' },\r\n  status: 200,\r\n  statusText: null,\r\n  headers: { 'content-type': 'application/json' },\r\n  config:\r\n   { transformRequest: { '0': [Function: transformResponseJSON] },\r\n     transformResponse: { '0': [Function: transformResponseJSON] },\r\n     headers:\r\n      { Accept: 'application/json',\r\n        'Content-Type': 'application/json',\r\n        'X-Internal-Base-Url': 'about://',\r\n        'X-Internal-Request-Id': '7dca3b09-0d01-4546-b2d8-bea1c9f43e65',\r\n        'User-Agent': 'axios/0.9.1',\r\n        'Content-Length': 48 },\r\n     timeout: 0,\r\n     xsrfCookieName: 'XSRF-TOKEN',\r\n     xsrfHeaderName: 'X-XSRF-TOKEN',\r\n     method: 'post',\r\n     url: 'https://domain.com/api/v1/auth',\r\n     data: '{\"user_name\":\"test@domain.com\",\"password\":\"test\"}',\r\n     withCredentials: undefined } }\r\n```\r\nThe response of an actual call is\r\n```\r\n{ data:\r\n   { role: 'ADMIN',\r\n     jwt_token: 'eyJraWQiOi...',\r\n     user_id: 'FN8XV1R20V' },\r\n  status: 200,\r\n  statusText: 'OK',\r\n  headers:\r\n   { 'content-type': 'application/json',\r\n     date: 'Tue, 17 May 2016 17:14:53 GMT',\r\n     server: 'nginx/1.8.0',\r\n     vary: 'Accept-Encoding',\r\n     'content-length': '638',\r\n     connection: 'Close' },\r\n  config:\r\n   { transformRequest: { '0': [Function: transformResponseJSON] },\r\n     transformResponse: { '0': [Function: transformResponseJSON] },\r\n     headers:\r\n      { Accept: 'application/json',\r\n        'Content-Type': 'application/json',\r\n        'X-Internal-Base-Url': 'about://',\r\n        'X-Internal-Request-Id': 'fab22a84-74a3-4d4c-bd78-8ac8b3aebb50',\r\n        'User-Agent': 'axios/0.9.1',\r\n        'Content-Length': 48 },\r\n     timeout: 0,\r\n     xsrfCookieName: 'XSRF-TOKEN',\r\n     xsrfHeaderName: 'X-XSRF-TOKEN',\r\n     method: 'post',\r\n     url: 'https://mydomain.com/api/v1/auth',\r\n     data: '{\"user_name\":\"test@domain.com\",\"password\":\"test\"}',\r\n     withCredentials: undefined } }\r\n```\r\nAlso, the api call that the `nock.recorder.rec()` call gave\r\n\r\n```javascript\r\nnock('https://mydomain.com:443', {\"encodedQueryParams\":true})\r\n  .post('/api/v1/auth', {\"user_name\":\"test@domain.com\",\"password\":\"test\"})\r\n  .reply(200, {\"role\":\"ADMIN\",\"jwt_token\":\"eyJra...\",\"user_id\":\"FN8XV1R20V\"}, { 'content-type': 'application/json',\r\n  date: 'Tue, 17 May 2016 17:29:31 GMT',\r\n  server: 'nginx/1.8.0',\r\n  vary: 'Accept-Encoding',\r\n  'content-length': '638',\r\n  connection: 'Close' });\r\n```\r\ndidn't work for me.\r\nThanks"},"comment":{"url":"https://api.github.com/repos/node-nock/nock/issues/comments/254742773","html_url":"https://github.com/node-nock/nock/issues/558#issuecomment-254742773","issue_url":"https://api.github.com/repos/node-nock/nock/issues/558","id":254742773,"user":{"login":"vrinek","id":81346,"avatar_url":"https://avatars.githubusercontent.com/u/81346?v=3","gravatar_id":"","url":"https://api.github.com/users/vrinek","html_url":"https://github.com/vrinek","followers_url":"https://api.github.com/users/vrinek/followers","following_url":"https://api.github.com/users/vrinek/following{/other_user}","gists_url":"https://api.github.com/users/vrinek/gists{/gist_id}","starred_url":"https://api.github.com/users/vrinek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vrinek/subscriptions","organizations_url":"https://api.github.com/users/vrinek/orgs","repos_url":"https://api.github.com/users/vrinek/repos","events_url":"https://api.github.com/users/vrinek/events{/privacy}","received_events_url":"https://api.github.com/users/vrinek/received_events","type":"User","site_admin":false},"created_at":"2016-10-19T08:04:43Z","updated_at":"2016-10-19T08:04:43Z","body":"I've added this issue to a project along with [a PR that seems to be abandoned](https://github.com/node-nock/nock/issues/587). Please take a look if that PR's scope would cover your use case."}}
{"actor":{"display_login":"vrinek"}}