Skip to content

Commit

Permalink
Lint test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
parthverma1 committed Jun 14, 2024
1 parent f43a466 commit 816c0d0
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 213 deletions.
2 changes: 1 addition & 1 deletion lib/redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ Redirect.prototype.onResponse = function (response) {

// Wait for request to end before firing redirect request
request.once('finish', () => {
request.init(options);
request.init(options)
})

return true
Expand Down
17 changes: 9 additions & 8 deletions request.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
var tls = require('tls')
var http = require('http')
var https = require('https')
var http2 = require('./lib/http2').default;
var autohttp2 = require('./lib/autohttp').default;
var http2 = require('./lib/http2').default
var autohttp2 = require('./lib/autohttp').default
var url = require('url')
var util = require('util')
var stream = require('stream')
Expand Down Expand Up @@ -595,11 +595,12 @@ Request.prototype.init = function (options) {

// If user defines httpModules, respect if they have different httpModules for different http versions, else use the tls specific http module
// If the user defines nothing, revert to default modules
self.httpModule = httpModules[protocol]?.[self.protocolVersion] || httpModules[protocol] || defaultModules[protocol][self.protocolVersion]
self.httpModule = (httpModules[protocol] && httpModules[protocol][self.protocolVersion]) || httpModules[protocol] ||
defaultModules[protocol][self.protocolVersion]

if (!httpModules[protocol]?.[options.protocolVersion] && httpModules[protocol]){
if (httpModules[protocol] && !(httpModules[protocol][options.protocolVersion])) {
// If the user is only specifying https/http modules, revert to http1
self.protocolVersion = 'http1';
self.protocolVersion = 'http1'
}

if (!self.httpModule) {
Expand Down Expand Up @@ -922,7 +923,7 @@ Request.prototype.start = function () {
// at the _exact_ same time, they should be close enough to be able to calculate
// high-resolution, monotonically non-decreasing timestamps relative to startTime.
var startTime = new Date().getTime()
var startTimeNow = performance.now()
var startTimeNow = now()
}

if (self._aborted) {
Expand Down Expand Up @@ -1212,13 +1213,13 @@ Request.prototype.onRequestResponse = function (response) {
var self = this

if (self.timing) {
self.timings.response = performance.now() - self.startTimeNow
self.timings.response = now() - self.startTimeNow
}

debug('onRequestResponse', self.uri.href, response.statusCode, response.headers)
response.on('end', function () {
if (self.timing) {
self.timings.end = performance.now() - self.startTimeNow
self.timings.end = now() - self.startTimeNow
response.timingStart = self.startTime
response.timingStartTimer = self.startTimeNow

Expand Down
47 changes: 0 additions & 47 deletions test.js

This file was deleted.

2 changes: 1 addition & 1 deletion tests/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ exports.createHttp2Server = function (opts) {
}

var s = http2.createSecureServer(options, function (req, resp) {
s.emit(req.url, req, resp);
s.emit(req.url, req, resp)
})
s.on('listening', function () {
s.port = this.address().port
Expand Down
Loading

0 comments on commit 816c0d0

Please sign in to comment.