mirror of
https://github.com/PretendoNetwork/miiverse-api.git
synced 2026-09-13 02:55:13 -05:00
use response.status() method and not response.statusCode setter
This commit is contained in:
@@ -79,7 +79,7 @@ async function auth(request: express.Request, response: express.Response, next:
|
||||
|
||||
function badAuth(response: express.Response): void {
|
||||
response.type('application/xml');
|
||||
response.statusCode = 400;
|
||||
response.status(400);
|
||||
|
||||
response.send('<?xml version="1.0" encoding="UTF-8"?>\n' + xml({
|
||||
result: {
|
||||
@@ -132,7 +132,7 @@ function serverError(response: express.Response, discovery: HydratedEndpointDocu
|
||||
}
|
||||
|
||||
response.type('application/xml');
|
||||
response.statusCode = 400;
|
||||
response.status(400);
|
||||
|
||||
response.send('<?xml version="1.0" encoding="UTF-8"?>\n' + xml({
|
||||
result: {
|
||||
|
||||
@@ -40,7 +40,7 @@ app.use(api);
|
||||
LOG_INFO('Creating 404 status handler');
|
||||
app.use((_request: express.Request, response: express.Response) => {
|
||||
response.type('application/xml');
|
||||
response.statusCode = 404;
|
||||
response.status(404);
|
||||
|
||||
return response.send('<?xml version="1.0" encoding="UTF-8"?>\n' + xml({
|
||||
result: {
|
||||
@@ -57,7 +57,7 @@ LOG_INFO('Creating non-404 status handler');
|
||||
app.use((error: any, _request: express.Request, response: express.Response, _next: express.NextFunction) => {
|
||||
const status: number = error.status || 500;
|
||||
response.type('application/xml');
|
||||
response.statusCode = 404;
|
||||
response.status(404);
|
||||
|
||||
return response.send('<?xml version="1.0" encoding="UTF-8"?>\n' + xml({
|
||||
result: {
|
||||
|
||||
@@ -155,7 +155,7 @@ router.get('/', async function (request: express.Request, response: express.Resp
|
||||
|
||||
if (!postID) {
|
||||
response.type('application/xml');
|
||||
response.statusCode = 404;
|
||||
response.status(404);
|
||||
response.send('<?xml version="1.0" encoding="UTF-8"?>\n' + xml({
|
||||
result: {
|
||||
has_error: 1,
|
||||
@@ -170,7 +170,7 @@ router.get('/', async function (request: express.Request, response: express.Resp
|
||||
const post: HydratedPostDocument | null = await getPostByID(postID);
|
||||
|
||||
if (!post) {
|
||||
response.statusCode = 404;
|
||||
response.status(404);
|
||||
response.send('<?xml version="1.0" encoding="UTF-8"?>\n' + xml({
|
||||
result: {
|
||||
has_error: 1,
|
||||
@@ -348,7 +348,7 @@ async function newPost(request: express.Request, response: express.Response): Pr
|
||||
const duplicatePost = await getDuplicatePosts(request.pid, document);
|
||||
|
||||
if (duplicatePost) {
|
||||
response.statusCode = 400;
|
||||
response.status(400);
|
||||
response.send('<?xml version="1.0" encoding="UTF-8"?>\n' + xml({
|
||||
result: {
|
||||
has_error: 1,
|
||||
|
||||
@@ -80,7 +80,7 @@ router.get('/', async function (request: express.Request, response: express.Resp
|
||||
break;
|
||||
}
|
||||
|
||||
response.statusCode = 400;
|
||||
response.status(400);
|
||||
response.send('<?xml version="1.0" encoding="UTF-8"?>\n' + xml({
|
||||
result: {
|
||||
has_error: 1,
|
||||
|
||||
Reference in New Issue
Block a user