List of usage examples for com.squareup.okhttp HttpUrl query
public String query()
From source file:com.ibm.watson.developer_cloud.service.AlchemyService.java
License:Open Source License
/** * Adds the Alchemy API key to HTTP request. * //ww w . j a v a 2 s. com * @param builder the builder * @param apiKey the API key token */ private void addApiKeyToRequest(Builder builder, String apiKey) { final HttpUrl url = HttpUrl.parse(builder.build().urlString()); if (url.query() == null || url.query().isEmpty()) { builder.url(builder.build().url() + "?" + apiKey); } else { builder.url(builder.build().url() + "&" + apiKey); } }