Skip to content

Commit 757b9a1

Browse files
committed
[fix] Do not poll if the Location header is missing
Fixes: MONEI#471
1 parent 88d5e04 commit 757b9a1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Shopify.prototype.request = function request(uri, method, key, data, headers) {
136136

137137
this.updateLimits(res.headers['x-shopify-shop-api-call-limit']);
138138

139-
if (res.statusCode === 202) {
139+
if (res.statusCode === 202 && res.headers['location']) {
140140
const retryAfter = res.headers['retry-after'] * 1000 || 0;
141141
const { pathname, search } = url.parse(res.headers['location']);
142142

test/resource-feedback.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('Shopify#resourceFeedback', () => {
1515
const input = fixtures.req.create;
1616
const output = fixtures.res.create;
1717

18-
scope.post('/admin/resource_feedback.json', input).reply(201, output);
18+
scope.post('/admin/resource_feedback.json', input).reply(202, output);
1919

2020
return shopify.resourceFeedback
2121
.create(input.resource_feedback)

0 commit comments

Comments
 (0)