Skip to content

Commit

Permalink
DB: formatting, appearance
Browse files Browse the repository at this point in the history
  • Loading branch information
traines-source committed Jan 10, 2025
1 parent 7a80604 commit 4fe6602
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/de/schildbach/pte/DbProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,16 @@ public DbProvider() {
this.tripEndpoint = API_BASE.newBuilder().addPathSegments("angebote/fahrplan").build();
this.locationsEndpoint = API_BASE.newBuilder().addPathSegments("location/search").build();
this.nearbyEndpoint = API_BASE.newBuilder().addPathSegments("location/nearby").build();
this.resultHeader = new ResultHeader(network, "DB (movas)");
this.resultHeader = new ResultHeader(network, "movas");
}

private String doRequest(final HttpUrl url, final String body, final String contentType) throws IOException {
// DB API requires these headers
// Content-Type must be exactly as passed below,
// passing it to httpClient.get would add charset suffix
httpClient.setHeader("X-Correlation-ID", "null");
httpClient.setHeader("Accept", contentType);
httpClient.setHeader("Content-Type", contentType);
// Content-Type must be exactly as passed above (no charset)
final CharSequence page = httpClient.get(url, body, null);
return page.toString();
}
Expand Down
4 changes: 3 additions & 1 deletion test/de/schildbach/pte/live/DbProviderLiveTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ public void noTrips() throws Exception {
@Test
public void ambiguousTrips() throws Exception {
final Location from = new Location(LocationType.STATION, null, null, "berlin hbf");
final Location to = new Location(LocationType.ADDRESS, "A=2@O=München - Berg am Laim, Friedenstraße 2@X=11602251@Y=48123949@U=103@L=980857648@B=1@p=1378873973@", null, "irrelevant");
final Location to = new Location(LocationType.ADDRESS,
"A=2@O=München - Berg am Laim, Friedenstraße 2@X=11602251@Y=48123949@U=103@L=980857648@B=1@p=1378873973@",
null, "irrelevant");
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
assertEquals(QueryTripsResult.Status.OK, result.status);
print(result);
Expand Down

0 comments on commit 4fe6602

Please sign in to comment.