mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel
This commit is contained in:
commit
007cae87e6
|
@ -23,8 +23,8 @@ exports.mimeTypes = {
|
|||
"html": [ "text/html", true ],
|
||||
"htm": [ "text/html", true ],
|
||||
"pdf": [ "application/pdf", false ],
|
||||
"text": [ "text/plain", true ],
|
||||
"txt": [ "text/plain", true ],
|
||||
"text": [ "text/plain", true ],
|
||||
"xml": [ "application/xml", true ]
|
||||
};
|
||||
|
||||
|
@ -35,7 +35,7 @@ exports.extensions = {
|
|||
"image/x-icon": [ "ico" ],
|
||||
"image/gif": [ "gif" ],
|
||||
"image/jpg": [ "jpg" ],
|
||||
"text/plain": [ "text", "txt" ],
|
||||
"text/plain": [ "txt", "text" ],
|
||||
"application/xml": [ "xml" ],
|
||||
"application/json": [ "json" ],
|
||||
"text/css": [ "css" ],
|
||||
|
|
|
@ -22,8 +22,8 @@ exports.mimeTypes = {
|
|||
"html": [ "text/html", true ],
|
||||
"htm": [ "text/html", true ],
|
||||
"pdf": [ "application/pdf", false ],
|
||||
"text": [ "text/plain", true ],
|
||||
"txt": [ "text/plain", true ],
|
||||
"text": [ "text/plain", true ],
|
||||
"xml": [ "application/xml", true ]
|
||||
};
|
||||
|
||||
|
@ -34,7 +34,7 @@ exports.extensions = {
|
|||
"image/x-icon": [ "ico" ],
|
||||
"image/gif": [ "gif" ],
|
||||
"image/jpg": [ "jpg" ],
|
||||
"text/plain": [ "text", "txt" ],
|
||||
"text/plain": [ "txt", "text" ],
|
||||
"application/xml": [ "xml" ],
|
||||
"application/json": [ "json" ],
|
||||
"text/css": [ "css" ],
|
||||
|
|
|
@ -304,7 +304,21 @@ function DocumentationAndConstraintsSpec () {
|
|||
assertEqual(routes[0].docs.notes, "c");
|
||||
},
|
||||
|
||||
testDefineSummaryRestrictedTo60Characters: function () {
|
||||
testNicknameFormat: function () {
|
||||
var error;
|
||||
|
||||
try {
|
||||
app.get('/foxx', function () {
|
||||
//nothing
|
||||
}).nickname("a b");
|
||||
} catch(e) {
|
||||
error = e;
|
||||
}
|
||||
|
||||
assertEqual(error, "Nickname may only contain [a-z]");
|
||||
},
|
||||
|
||||
testSummaryRestrictedTo60Characters: function () {
|
||||
var error;
|
||||
|
||||
try {
|
||||
|
|
|
@ -504,6 +504,9 @@ _.extend(RequestContext.prototype, {
|
|||
|
||||
nickname: function (nickname) {
|
||||
'use strict';
|
||||
if (!nickname.match(/^[a-z]+$/)) {
|
||||
throw "Nickname may only contain [a-z]";
|
||||
}
|
||||
this.route.docs.nickname = nickname;
|
||||
return this;
|
||||
},
|
||||
|
@ -741,6 +744,7 @@ FormatMiddleware = function (allowedFormats, defaultFormat) {
|
|||
|
||||
determinePathAndFormat = function (path, headers) {
|
||||
var mimeTypes = require("org/arangodb/mimetypes").mimeTypes,
|
||||
extensions = require("org/arangodb/mimetypes").extensions,
|
||||
urlFormatToMime = function (urlFormat) {
|
||||
var mimeType;
|
||||
|
||||
|
@ -755,11 +759,11 @@ FormatMiddleware = function (allowedFormats, defaultFormat) {
|
|||
mimeToUrlFormat = function (mimeType) {
|
||||
var urlFormat;
|
||||
|
||||
urlFormat = {
|
||||
"application/json": "json",
|
||||
"text/html": "html",
|
||||
"text/plain": "txt"
|
||||
}[mimeType];
|
||||
if (extensions[mimeType]) {
|
||||
urlFormat = extensions[mimeType][0];
|
||||
} else {
|
||||
urlFormat = undefined;
|
||||
}
|
||||
|
||||
return urlFormat;
|
||||
},
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"html","text/html",true
|
||||
"htm","text/html",true
|
||||
"pdf","application/pdf",false
|
||||
"text","text/plain",true
|
||||
"txt","text/plain",true
|
||||
"text","text/plain",true
|
||||
"xml","application/xml",true
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@ void TRI_InitialiseEntriesMimetypes (void) {
|
|||
TRI_RegisterMimetype("html", "text/html", true);
|
||||
TRI_RegisterMimetype("htm", "text/html", true);
|
||||
TRI_RegisterMimetype("pdf", "application/pdf", false);
|
||||
TRI_RegisterMimetype("text", "text/plain", true);
|
||||
TRI_RegisterMimetype("txt", "text/plain", true);
|
||||
TRI_RegisterMimetype("text", "text/plain", true);
|
||||
TRI_RegisterMimetype("xml", "application/xml", true);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue