addXClientTime static method

void addXClientTime(
  1. RequestOptions requestOptions
)

Adds an 'X-Client-Time' header to the RequestOptions.

This header stores the current timestamp in milliseconds since epoch, which can be used later to calculate the duration of the request/response cycle. This is useful for measuring response time.

requestOptions The RequestOptions to which the header will be added. Adds an 'X-Client-Time' header to the RequestOptions if it doesn't already exist.

This is a private helper method used internally to ensure the client time is recorded for request tracking.

requestOptions The RequestOptions to modify.

Implementation

static void addXClientTime(RequestOptions requestOptions) {
  if (!requestOptions.headers.containsKey(kXClientTime)) {
    requestOptions.headers[kXClientTime] = DateTime.now()
        .millisecondsSinceEpoch
        .toString();
  }
}