Check for X-Zotero-Connector-API-Version header in /connector/import
This commit is contained in:
parent
2964021661
commit
708b8798c2
2 changed files with 16 additions and 3 deletions
|
@ -1135,6 +1135,10 @@ Zotero.Server.Connector.Import.prototype = {
|
|||
permitBookmarklet: false,
|
||||
|
||||
init: async function (requestData) {
|
||||
if (!('X-Zotero-Connector-API-Version' in requestData.headers)) {
|
||||
return 400;
|
||||
}
|
||||
|
||||
let translate = new Zotero.Translate.Import();
|
||||
translate.setString(requestData.data);
|
||||
let translators = await translate.getTranslators();
|
||||
|
|
|
@ -1393,7 +1393,10 @@ describe("Connector Server", function () {
|
|||
'POST',
|
||||
endpoint,
|
||||
{
|
||||
headers: { "Content-Type": "text/plain" },
|
||||
headers: {
|
||||
"Content-Type": "text/plain",
|
||||
"X-Zotero-Connector-API-Version": "2"
|
||||
},
|
||||
body: 'Owl'
|
||||
}
|
||||
));
|
||||
|
@ -1418,7 +1421,10 @@ describe("Connector Server", function () {
|
|||
'POST',
|
||||
endpoint,
|
||||
{
|
||||
headers: { "Content-Type": "application/x-bibtex" },
|
||||
headers: {
|
||||
"Content-Type": "application/x-bibtex",
|
||||
"X-Zotero-Connector-API-Version": "2"
|
||||
},
|
||||
body: resource
|
||||
}
|
||||
);
|
||||
|
@ -1451,7 +1457,10 @@ describe("Connector Server", function () {
|
|||
'POST',
|
||||
endpoint,
|
||||
{
|
||||
headers: { "Content-Type": "application/x-bibtex" },
|
||||
headers: {
|
||||
"Content-Type": "application/x-bibtex",
|
||||
"X-Zotero-Connector-API-Version": "2"
|
||||
},
|
||||
body: resource,
|
||||
successCodes: false
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue