|
2 | 2 |
|
3 | 3 | package com.google.api.client.googleapis.batch; |
4 | 4 |
|
| 5 | +import static java.nio.charset.StandardCharsets.UTF_8; |
| 6 | + |
5 | 7 | import com.google.api.client.googleapis.batch.BatchRequest.RequestInfo; |
6 | 8 | import com.google.api.client.googleapis.json.GoogleJsonError; |
7 | 9 | import com.google.api.client.googleapis.json.GoogleJsonError.ErrorInfo; |
@@ -701,30 +703,34 @@ public void testExecute_checkWriteTo() throws Exception { |
701 | 703 |
|
702 | 704 | final StringBuilder expectedOutput = new StringBuilder(); |
703 | 705 | expectedOutput.append("--__END_OF_PART__\r\n"); |
704 | | - expectedOutput.append("Content-Length: 109\r\n"); |
| 706 | + expectedOutput.append("Content-Length: 118\r\n"); |
705 | 707 | expectedOutput.append("Content-Type: application/http\r\n"); |
706 | 708 | expectedOutput.append("content-id: 1\r\n"); |
707 | 709 | expectedOutput.append("content-transfer-encoding: binary\r\n"); |
708 | 710 | expectedOutput.append("\r\n"); |
709 | | - expectedOutput.append("POST http://test/dummy/url1\r\n"); |
| 711 | + expectedOutput.append("POST http://test/dummy/url1 HTTP/1.1\r\n"); |
710 | 712 | expectedOutput.append("Content-Length: 26\r\n"); |
711 | 713 | expectedOutput.append("Content-Type: " + request1ContentType + "\r\n"); |
712 | 714 | expectedOutput.append("\r\n"); |
713 | 715 | expectedOutput.append(request1Content + "\r\n"); |
714 | 716 | expectedOutput.append("--__END_OF_PART__\r\n"); |
715 | | - expectedOutput.append("Content-Length: 30\r\n"); |
| 717 | + expectedOutput.append("Content-Length: 39\r\n"); |
716 | 718 | expectedOutput.append("Content-Type: application/http\r\n"); |
717 | 719 | expectedOutput.append("content-id: 2\r\n"); |
718 | 720 | expectedOutput.append("content-transfer-encoding: binary\r\n"); |
719 | 721 | expectedOutput.append("\r\n"); |
720 | | - expectedOutput.append("GET http://test/dummy/url2\r\n"); |
| 722 | + expectedOutput.append("GET http://test/dummy/url2 HTTP/1.1\r\n"); |
721 | 723 | expectedOutput.append("\r\n"); |
722 | 724 | expectedOutput.append("\r\n"); |
723 | 725 | expectedOutput.append("--__END_OF_PART__--\r\n"); |
724 | 726 | MockHttpTransport transport = new MockHttpTransport(); |
725 | | - HttpRequest request1 = transport.createRequestFactory().buildRequest( |
726 | | - request1Method, new GenericUrl(request1Url), |
727 | | - new ByteArrayContent(request1ContentType, request1Content.getBytes())); |
| 727 | + HttpRequest request1 = |
| 728 | + transport |
| 729 | + .createRequestFactory() |
| 730 | + .buildRequest( |
| 731 | + request1Method, |
| 732 | + new GenericUrl(request1Url), |
| 733 | + new ByteArrayContent(request1ContentType, request1Content.getBytes(UTF_8))); |
728 | 734 | HttpRequest request2 = transport.createRequestFactory() |
729 | 735 | .buildRequest(request2Method, new GenericUrl(request2Url), null); |
730 | 736 | subtestExecute_checkWriteTo(expectedOutput.toString(), request1, request2); |
@@ -806,9 +812,9 @@ public boolean retrySupported() { |
806 | 812 | } |
807 | 813 | }); |
808 | 814 | subtestExecute_checkWriteTo(new StringBuilder().append("--__END_OF_PART__\r\n") |
809 | | - .append("Content-Length: 27\r\n").append("Content-Type: application/http\r\n") |
| 815 | + .append("Content-Length: 36\r\n").append("Content-Type: application/http\r\n") |
810 | 816 | .append("content-id: 1\r\n").append("content-transfer-encoding: binary\r\n").append("\r\n") |
811 | | - .append("POST http://google.com/\r\n").append("\r\n").append("\r\n") |
| 817 | + .append("POST http://google.com/ HTTP/1.1\r\n").append("\r\n").append("\r\n") |
812 | 818 | .append("--__END_OF_PART__--\r\n").toString(), request1); |
813 | 819 | } |
814 | 820 |
|
|
0 commit comments