mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Switch to using status
over statusCode
This is a difference in the request/fetch APIs. GitOrigin-RevId: bde9adcf4de2ceaabfd9baae7a93bf2b0b5e5a1e
This commit is contained in:
parent
0a62bc1239
commit
2ccd39b2fa
3 changed files with 16 additions and 17 deletions
|
@ -51,7 +51,7 @@ const promises = {
|
|||
)
|
||||
throw error
|
||||
}
|
||||
if (response.statusCode === 404) {
|
||||
if (response.status === 404) {
|
||||
// actually not an error in this case, just no existing account
|
||||
logger.debug(
|
||||
{ userId: user._id },
|
||||
|
@ -355,7 +355,7 @@ const promises = {
|
|||
expect422: true,
|
||||
})
|
||||
|
||||
if (response.statusCode === 422) {
|
||||
if (response.status === 422) {
|
||||
return await RecurlyWrapper.promises._handle422Response(body)
|
||||
} else {
|
||||
return await RecurlyWrapper.promises._parseSubscriptionXml(body)
|
||||
|
@ -713,7 +713,7 @@ const promises = {
|
|||
},
|
||||
expect404: true,
|
||||
})
|
||||
if (response.statusCode === 404) {
|
||||
if (response.status === 404) {
|
||||
return []
|
||||
} else {
|
||||
return await RecurlyWrapper.promises._parseSubscriptionsXml(body)
|
||||
|
|
|
@ -166,7 +166,7 @@ const getInvoicePage = fullInvoicesIds => queryOptions => {
|
|||
const hasMore = end < fullInvoicesIds.length
|
||||
const nextPageCursor = hasMore ? `${end}%3A${end + ITEMS_PER_PAGE}&v=2` : null
|
||||
const response = {
|
||||
statusCode: 200,
|
||||
status: 200,
|
||||
headers: {
|
||||
link: hasMore
|
||||
? `https://fakerecurly.com/v2/invoices?cursor=${nextPageCursor}`
|
||||
|
@ -188,7 +188,7 @@ describe('CollectPayPalPastDueInvoice', function () {
|
|||
|
||||
if (/accounts\/(\d+)\/billing_info/.test(options.url)) {
|
||||
return {
|
||||
response: { statusCode: 200, headers: {} },
|
||||
response: { status: 200, headers: {} },
|
||||
body: billingInfoXml,
|
||||
}
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ describe('CollectPayPalPastDueInvoice', function () {
|
|||
const invoiceId = options.url.match(/invoices\/(\d+)\/collect/)[1]
|
||||
if (invoiceId < 400) {
|
||||
return {
|
||||
response: { statusCode: 200, headers: {} },
|
||||
response: { status: 200, headers: {} },
|
||||
body: invoiceCollectXml,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,13 +94,12 @@ const mockApiRequest = function (options) {
|
|||
if (fixtures[options.url]) {
|
||||
return {
|
||||
err: null,
|
||||
response: { statusCode: 200 },
|
||||
response: { status: 200 },
|
||||
body: fixtures[options.url],
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
err: new Error('Not found'),
|
||||
response: { statusCode: 404 },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -585,7 +584,7 @@ describe('RecurlyWrapper', function () {
|
|||
threeDSecureActionResult: 'a-3d-token-id',
|
||||
}
|
||||
this.apiRequest = sinon.stub(this.RecurlyWrapper.promises, 'apiRequest')
|
||||
this.response = { statusCode: 200 }
|
||||
this.response = { status: 200 }
|
||||
this.body = '<xml>is_bad</xml>'
|
||||
this.apiRequest.resolves({
|
||||
response: this.response,
|
||||
|
@ -684,7 +683,7 @@ describe('RecurlyWrapper', function () {
|
|||
`
|
||||
// this.apiRequest.yields(null, { statusCode: 422 }, body)
|
||||
this.apiRequest.resolves({
|
||||
response: { statusCode: 422 },
|
||||
response: { status: 422 },
|
||||
body,
|
||||
})
|
||||
})
|
||||
|
@ -948,7 +947,7 @@ describe('RecurlyWrapper', function () {
|
|||
const resultXml =
|
||||
'<account><account_code>abc</account_code></account>'
|
||||
this.apiRequest.resolves({
|
||||
response: { statusCode: 200 },
|
||||
response: { status: 200 },
|
||||
body: resultXml,
|
||||
})
|
||||
})
|
||||
|
@ -987,7 +986,7 @@ describe('RecurlyWrapper', function () {
|
|||
describe('when the account does not exist', function () {
|
||||
beforeEach(function () {
|
||||
this.apiRequest.resolves({
|
||||
response: { statusCode: 404 },
|
||||
response: { status: 404 },
|
||||
body: '',
|
||||
})
|
||||
})
|
||||
|
@ -1095,7 +1094,7 @@ describe('RecurlyWrapper', function () {
|
|||
const resultXml =
|
||||
'<account><account_code>abc</account_code></account>'
|
||||
this.apiRequest.resolves({
|
||||
response: { statusCode: 200 },
|
||||
response: { status: 200 },
|
||||
body: resultXml,
|
||||
})
|
||||
})
|
||||
|
@ -1174,7 +1173,7 @@ describe('RecurlyWrapper', function () {
|
|||
beforeEach(function () {
|
||||
const resultXml = '<billing_info><a>1</a></billing_info>'
|
||||
this.apiRequest.resolves({
|
||||
response: { statusCode: 200 },
|
||||
response: { status: 200 },
|
||||
body: resultXml,
|
||||
})
|
||||
})
|
||||
|
@ -1260,7 +1259,7 @@ describe('RecurlyWrapper', function () {
|
|||
beforeEach(function () {
|
||||
const resultXml = '<billing_info><city>London</city></billing_info>'
|
||||
this.apiRequest.resolves({
|
||||
response: { statusCode: 200 },
|
||||
response: { status: 200 },
|
||||
body: resultXml,
|
||||
})
|
||||
})
|
||||
|
@ -1328,7 +1327,7 @@ describe('RecurlyWrapper', function () {
|
|||
beforeEach(function () {
|
||||
const resultXml = '<subscription><a>1</a></subscription>'
|
||||
this.apiRequest.resolves({
|
||||
response: { statusCode: 200 },
|
||||
response: { status: 200 },
|
||||
body: resultXml,
|
||||
})
|
||||
})
|
||||
|
@ -1437,7 +1436,7 @@ describe('RecurlyWrapper', function () {
|
|||
|
||||
describe('without an account', function () {
|
||||
beforeEach(async function () {
|
||||
this.response.statusCode = 404
|
||||
this.response.status = 404
|
||||
this.accountActiveSubscriptions =
|
||||
await this.RecurlyWrapper.promises.listAccountActiveSubscriptions(
|
||||
this.user_id
|
||||
|
|
Loading…
Reference in a new issue