{"size": 1027, "ext": "js", "max_stars_repo_path": "src/rest/requests/RequestNeedingAuthentication.js", "max_stars_repo_name": "HectorRicardo/thingworx-connect", "max_stars_repo_stars_event_min_datetime": "2020-02-14T21:23:28.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-17T09:04:34.000Z", "max_issues_repo_path": "src/rest/requests/RequestNeedingAuthentication.js", "max_issues_repo_name": "HectorRicardo/thingworx-connect", "max_issues_repo_issues_event_min_datetime": "2021-05-11T03:31:27.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-11T03:31:27.000Z", "max_forks_repo_path": "src/rest/requests/RequestNeedingAuthentication.js", "max_forks_repo_name": "HectorRicardo/thingworx-connect", "max_forks_repo_forks_event_min_datetime": "2021-12-08T15:43:58.000Z", "max_forks_repo_forks_event_max_datetime": "2021-12-08T15:43:58.000Z"}
{"max_stars_count": 7, "max_issues_count": 1, "max_forks_count": 1, "avg_line_length": 42.7916666667, "max_line_length": 137, "alphanum_fraction": 0.7185978578}
/**
 * This class does not extend the Request interface because the Request interface's properties are
 * read-only, and we still need to modify the options of the request in order to put the
 * authentication parameters. When calling .send(), the connection object will add the
 * authentication parameters, and for that, the options need to be modifiable.
 */
export default class RequestNeedingAuthentication {
  /**
   * Create a request that needs to be filled in with authentication parameters.
   *
   * @param {string} url - the complete URL this request will go to.
   * @param {object} options - the options for this request.
   * @param {Server} server - the instance of the server this request belongs to.
   */
  constructor(url, options, server) {
    if (!Object.isExtensible(options)) {
      throw new Error('Options of the request cannot be read-only, they need to be writable so the authentication parameters get added');
    }
    this.url = url;
    this.options = options;
    this.server = server;
  }
}
