in google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/http/UrlFetchTransport.java [111:139]
protected UrlFetchRequest buildRequest(String method, String url) throws IOException {
Preconditions.checkArgument(supportsMethod(method), "HTTP method %s not supported", method);
HTTPMethod httpMethod;
if (method.equals(HttpMethods.DELETE)) {
httpMethod = HTTPMethod.DELETE;
} else if (method.equals(HttpMethods.GET)) {
httpMethod = HTTPMethod.GET;
} else if (method.equals(HttpMethods.HEAD)) {
httpMethod = HTTPMethod.HEAD;
} else if (method.equals(HttpMethods.POST)) {
httpMethod = HTTPMethod.POST;
} else {
httpMethod = HTTPMethod.PUT;
}
// fetch options
FetchOptions fetchOptions =
FetchOptions.Builder.doNotFollowRedirects().disallowTruncate().validateCertificate();
switch (certificateValidationBehavior) {
case VALIDATE:
fetchOptions.validateCertificate();
break;
case DO_NOT_VALIDATE:
fetchOptions.doNotValidateCertificate();
break;
default:
break;
}
return new UrlFetchRequest(fetchOptions, httpMethod, url);
}