private <T> Single<T> requestInternal(final Function<HttpResponse, T> mapper) {
        final Request.Builder reqBuilder = prepareRequest();

        //execute, prepare if necessary
        final Single<Response> rawResponse;
        if (requestPreparer != null) {
            rawResponse = requestPreparer.call(reqBuilder).flatMap(this::executeRequest);
        } else {
            rawResponse = executeRequest(reqBuilder);
        }

        //map response
        final Single<T> result = rawResponse.map(r -> {
            final HttpResponse response = new HttpResponse();
            response.setResponse(r);
            final T mappedResponse = mapper.apply(response);
            if (mappedResponse instanceof HttpResponse && response != mappedResponse) {
                ((HttpResponse) mappedResponse).setFromHttpResponse(response);
            }
            if (response.getStatusCode() == 429) {
                Log.w("Request throttled: " + this.getRequestUrl());
                LifecycleAwareBroadcastReceiver.sendBroadcast(CgeoApplication.getInstance(), HTTP429, HTTP429_ADDRESS, Objects.requireNonNull(HttpUrl.parse(Objects.requireNonNull(getRequestUrl()))).host());
            }
            return mappedResponse;
        });

        return result;
    }
Convenience class used to ensapculate the building and usage of a HtmlRequest
main/src/main/java/cgeo/geocaching/network/HttpRequest.java