Skip to content
This repository has been archived by the owner on Mar 22, 2018. It is now read-only.

Commit

Permalink
Fix content types for XML responses (#153)
Browse files Browse the repository at this point in the history
* ensure xml has content header set

* import bluebird
  • Loading branch information
jamesadarich authored and arafato committed Feb 5, 2018
1 parent fa71d5a commit c2dbec6
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 7 deletions.
3 changes: 2 additions & 1 deletion lib/AzuriteQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const express = require('express'),
env = require('./core/env'),
bodyParser = require('body-parser'),
morgan = require('morgan'),
cli = require('./core/cli');
cli = require('./core/cli'),
BbPromise = require('bluebird');

class AzuriteQueue {
constructor() {
Expand Down
3 changes: 2 additions & 1 deletion lib/actions/blob/GetContainerAcl.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class GetContainerAcl {
.then((response) => {
if (response.proxy.original.access !== 'private') {
response.addHttpProperty(N.BLOB_PUBLIC_ACCESS, response.proxy.original.access);
}
}
response.addHttpProperty(N.CONTENT_TYPE, 'application/xml');
res.set(response.httpProps);
let xml = js2xmlparser.parse('SignedIdentifiers', response.proxy.original.signedIdentifiers || {});
xml = xml.replace(`<?xml version='1.0'?>`, `<?xml version="1.0" encoding="utf-8"?>`);
Expand Down
4 changes: 3 additions & 1 deletion lib/actions/queue/GetMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
const QueueManager = require('./../../core/queue/QueueManager'),
QueueMessagesListXmlModel = require('./../../xml/queue/QueueMessageList').QueueMessageListXmlModel,
QueueMessageXmlModel = require('./../../xml/queue/QueueMessageList').QueueMessageXmlModel,
AzuriteQueueResponse = require('./../../model/queue/AzuriteQueueResponse');
AzuriteQueueResponse = require('./../../model/queue/AzuriteQueueResponse'),
N = require('./../../core/HttpHeaderNames');

class GetMessages {
constructor() {
Expand All @@ -26,6 +27,7 @@ class GetMessages {
}
const xmlBody = model.toXml();
const response = new AzuriteQueueResponse();
response.addHttpProperty(N.CONTENT_TYPE, 'application/xml');
res.set(response.httpProps);
res.status(200).send(xmlBody);
}
Expand Down
4 changes: 3 additions & 1 deletion lib/actions/queue/GetQueueAcl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

const QueueManager = require('./../../core/queue/QueueManager'),
js2xmlparser = require("js2xmlparser"),
AzuriteQueueResponse = require('./../../model/queue/AzuriteQueueResponse');
AzuriteQueueResponse = require('./../../model/queue/AzuriteQueueResponse'),
N = require('./../../core/HttpHeaderNames');

class GetQueueAcl {
constructor() {
Expand All @@ -14,6 +15,7 @@ class GetQueueAcl {
let xml = js2xmlparser.parse('SignedIdentifiers', signedIdentifiers || {});
xml = xml.replace(`<?xml version='1.0'?>`, `<?xml version="1.0" encoding="utf-8"?>`);
const response = new AzuriteQueueResponse();
response.addHttpProperty(N.CONTENT_TYPE, 'application/xml');
res.set(response.httpProps);
res.status(200).send(xml);
}
Expand Down
4 changes: 3 additions & 1 deletion lib/actions/queue/ListQueues.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
const QueueManager = require('./../../core/queue/QueueManager'),
QueueListXmlModel = require('./../../xml/queue/QueueList').QueueList,
QueueXmlModel = require('./../../xml/queue/QueueList').Queue,
AzuriteQueueResponse = require('./../../model/queue/AzuriteQueueResponse');
AzuriteQueueResponse = require('./../../model/queue/AzuriteQueueResponse'),
N = require('./../../core/HttpHeaderNames');

class ListQueues {
constructor() {
Expand All @@ -26,6 +27,7 @@ class ListQueues {
}
const xmlString = xmlModel.toXml();
const response = new AzuriteQueueResponse();
response.addHttpProperty(N.CONTENT_TYPE, 'application/xml');
res.set(response.httpProps);
res.status(200).send(xmlString);
}
Expand Down
4 changes: 3 additions & 1 deletion lib/actions/queue/PeekMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
const QueueManager = require('./../../core/queue/QueueManager'),
QueueMessagesListXmlModel = require('./../../xml/queue/QueueMessageList').QueueMessageListXmlModel,
QueueMessageXmlModel = require('./../../xml/queue/QueueMessageList').QueueMessageXmlModel,
AzuriteQueueResponse = require('./../../model/queue/AzuriteQueueResponse');
AzuriteQueueResponse = require('./../../model/queue/AzuriteQueueResponse'),
N = require('./../../core/HttpHeaderNames');

class PeekMessages {
constructor() {
Expand All @@ -24,6 +25,7 @@ class PeekMessages {
}
const xmlBody = model.toXml();
const response = new AzuriteQueueResponse();
response.addHttpProperty(N.CONTENT_TYPE, 'application/xml');
res.set(response.httpProps);
res.status(200).send(xmlBody);
}
Expand Down
4 changes: 3 additions & 1 deletion lib/actions/queue/PutMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
const QueueManager = require('./../../core/queue/QueueManager'),
QueueMessagesListXmlModel = require('./../../xml/queue/QueueMessageList').QueueMessageListXmlModel,
QueueMessageXmlModel = require('./../../xml/queue/QueueMessageList').QueueMessageXmlModel,
AzuriteQueueResponse = require('./../../model/queue/AzuriteQueueResponse');
AzuriteQueueResponse = require('./../../model/queue/AzuriteQueueResponse'),
N = require('./../../core/HttpHeaderNames');

class PutMessage {
constructor() {
Expand All @@ -23,6 +24,7 @@ class PutMessage {
}));
const xmlBody = model.toXml();
const response = new AzuriteQueueResponse();
response.addHttpProperty(N.CONTENT_TYPE, 'application/xml');
res.set(response.httpProps);
res.status(201).send(xmlBody);
}
Expand Down

0 comments on commit c2dbec6

Please sign in to comment.