DEV: Add 201 to bootstrap-json accepted status codes (#15102)

The theme creator endpoints return JSON with a 201 CREATED
status code. With the recent changes to bootstrap-json/index.js
for the Ember CLI proxy, these endpoints were broken because
201 was not an accepted status code. This commit simply
adds 201 to the array, but prettier forced a reformat as well!
This commit is contained in:
Martin Brennan 2021-11-26 11:13:15 +10:00 committed by GitHub
parent 1b5f26e0ab
commit 73db60ad2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -230,7 +230,18 @@ async function handleRequest(proxy, baseURL, req, res) {
req.headers["X-Discourse-Asset-Path"] = req.path;
}
const acceptedStatusCodes = [200, 301, 302, 303, 307, 308, 404, 403, 500];
const acceptedStatusCodes = [
200,
201,
301,
302,
303,
307,
308,
404,
403,
500,
];
const proxyRequest = bent(req.method, acceptedStatusCodes);
const requestBody = req.method === "GET" ? null : req.body;
const response = await proxyRequest(url, requestBody, req.headers);