Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
add sbb test
Browse files Browse the repository at this point in the history
  • Loading branch information
andaryjo committed May 1, 2021
1 parent 270f4f2 commit 559c42d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/RequestAndParse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export async function request(url: string, requestorRef: string, headers: { [key
// Convert all header keys to lower case, to make sure that you actually overwrite the content-type header when specifying Content-Type
// HTTP headers are case-insensitive, so this shouldn't be a problem
for (const header in headers) {
if (header == header.toLocaleLowerCase()) continue;
headers[header.toLocaleLowerCase()] = headers[header];
if (header == header.toLowerCase()) continue;
headers[header.toLowerCase()] = headers[header];
delete headers.header;
}

Expand Down
18 changes: 13 additions & 5 deletions test/client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,22 @@ describe("Test providers", () => {
searchName: "karlsruhe",
journeyOrigin: "de:08212:1103",
journeyDestination: "de:08212:89"
}, {
name: "SBB",
url: creds["SBB"].url,
requestorRef: "trias-client",
headers: { "Authorization": creds["SBB"].token },
searchName: "messeplatz",
journeyOrigin: "8500010", // Basel, Hbf
journeyDestination: "8591442" // Zürich, Zoo
}, {
name: "VRN",
url: creds["VRN"].url,
requestorRef: creds["VRN"].token,
searchName: "bismarckplatz",
journeyOrigin: "de:08222:2432", // Lange Rötterstraße
journeyVia: "de:08221:1146", // Bismarckplatz
journeyDestination: "de:08221:1283" // Jägerhaus
journeyOrigin: "de:08222:2432", // Mannheim, Lange Rötterstraße
journeyVia: "de:08221:1146", // Heidelberg, Bismarckplatz
journeyDestination: "de:08221:1283" // Heidelberg, Jägerhaus
}, {
name: "VRR",
url: creds["VRR"].url,
Expand All @@ -39,8 +47,8 @@ describe("Test providers", () => {
requestorRef: creds["VVO"].token,
headers: { "Content-Type": "text/xml" },
searchName: "dresden",
journeyOrigin: "de:14612:28", // Dresden Hbf
journeyDestination: "de:14713:8010205" // Leipzig Hbf
journeyOrigin: "de:14612:28", // Dresden, Hbf
journeyDestination: "de:14713:8010205" // Leipzig, Hbf
}
]

Expand Down

0 comments on commit 559c42d

Please sign in to comment.