B2G/gecko/services/common/modules-testing/aitcserver.js
/**
   * HTTP handler for requests to /1.0/ which don't have a specific user
   * registered.
   */
HTTP handler for requests to /1.0/ which don't have a specific user
registered.
HTTP handler for requests to / 1 . 0 / which don ' t have a specific user registered .
function _generalHandler(request, response) {
    if (this.mockStatus.code && this.mockStatus.method) {
      this._respondWithMockStatus(request, response);
      return;
    }
    this._onRequest();
    let path = request.path;
    this._log.info("Request: " + request.method + " " + path);
    if (path.indexOf(this.VERSION_PATH) != 0) {
      throw new Error("generalHandler invoked improperly.");
    }
    let rest = request.path.substr(this.VERSION_PATH.length);
    if (!rest.length) {
      throw HTTP_404;
    }
    if (!this.autoCreateUsers) {
      throw HTTP_404;
    }
    let username;
    let index = rest.indexOf("/");
    if (index == -1) {
      username = rest;
    } else {
      username = rest.substr(0, index);
    }
    this.createUser(username);
    this._userHandler(username, request, response);
  }
function _generalHandler ( request , response ) { if ( this . mockStatus . code && this . mockStatus . method ) { this . _respondWithMockStatus ( request , response ) ; return ; } this . _onRequest ( ) ; let path = request . path ; this . _log . info ( "Request: " + request . method + " " + path ) ; if ( path . indexOf ( this . VERSION_PATH ) != 0 ) { throw new Error ( "generalHandler invoked improperly." ) ; } let rest = request . path . substr ( this . VERSION_PATH . length ) ; if ( ! rest . length ) { throw HTTP_404 ; } if ( ! this . autoCreateUsers ) { throw HTTP_404 ; } let username ; let index = rest . indexOf ( "/" ) ; if ( index == - 1 ) { username = rest ; } else { username = rest . substr ( 0 , index ) ; } this . createUser ( username ) ; this . _userHandler ( username , request , response ) ; }
HTTP handler for requests to /1.0/ which don't have a specific user
 registered.
HTTP handler for requests to / 1 . 0 / which don ' t have a specific user registered .