Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/main/java/com/textkernel/tx/services/ServiceBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ protected <T extends ApiResponse<?>> HttpResponse<T> executeRequest(Request apiR
rawResponse = _httpClient.newCall(apiRequest).execute();
apiResponse = new HttpResponse<T>(rawResponse, classOfT);

if (rawResponse != null && rawResponse.code() == 413) {
errorInfo.Message = "Request body was too large.";
throw new TxException(requestBody, rawResponse, errorInfo, null);
}

if (rawResponse != null && apiResponse.getData() == null && rawResponse.code() != 200) {
//something went wrong, a non-200 status code
errorInfo.Message = rawResponse.code() + " - " + rawResponse.message();
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/com/textkernel/tx/integration/ParsingTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ public <T extends Exception> void testParseBadInput(Document doc, Class<T> class
@Test
public void testLargeDocumentParse() {
TxException e = assertThrows(TxException.class, () -> {
Client.parser().parseResume(new ParseRequest(new Document(new byte[40_000_000], LocalDate.now()), null));
Client.parser().parseResume(new ParseRequest(new Document(new byte[20_000_000], LocalDate.now()), null));
});

String expected = "Request body was too large";
assertEquals(expected, e.getMessage().substring(0, expected.length()));
assertEquals(413, e.HttpStatusCode);
assertTrue(e.getMessage().startsWith("Request is too large to be processed by the server. Please do not send requests larger than"));
}

@Test
Expand Down
Loading