@SuppressWarnings("rawtypes") public static Request<?> getSampleRequestWithNonRepeatableContent( AmazonWebServiceRequest amazonWebServiceRequest) { DefaultRequest<?> request = new DefaultRequest(amazonWebServiceRequest, "non-existent-service"); request.setEndpoint(URI.create("http://non-existent-service.amazonaws.com")); // NonRepeatableInputStream#markSupported() returns false String content = "Some content that could only be read once."; request.setContent(new NonRepeatableInputStream(content)); request.addHeader("Content-Length", String.valueOf(content.length())); return request; }
@SuppressWarnings("rawtypes") public static Request<?> getSampleRequestWithRepeatableContent( AmazonWebServiceRequest amazonWebServiceRequest) { DefaultRequest<?> request = new DefaultRequest(amazonWebServiceRequest, "non-existent-service"); request.setEndpoint(URI.create("http://non-existent-service.amazonaws.com")); // StringInputStream#markSupported() returns true try { String content = "Some content that could be read for multiple times."; request.setContent(new StringInputStream(content)); request.addHeader("Content-Length", String.valueOf(content.length())); } catch (UnsupportedEncodingException e) { Assert.fail("Unable to set up the request content"); } return request; }