code: private static Request wrap(final Request req) {
          final AtomicBoolean seen = new AtomicBoolean(false);
          return new Request() {
              @Override
              public Iterable<String> head() throws IOException {
                  return req.head();
              }
  
              @Override
              public InputStream body() throws IOException {
                  if (!seen.getAndSet(true)) {
                      throw new IllegalStateException(
                          "It's not allowed to call body() more than once"
                      );
                  }
                  return req.body();
              }
          };
      }
docs: Wrap the request.
  @param req Request
  @return New request