Skip to content

Commit

Permalink
Merge pull request newrelic#65 from bizob2828/remove-methods-pkg
Browse files Browse the repository at this point in the history
removed methods lib and use our own implementation
  • Loading branch information
carlo-808 authored Jul 19, 2021
2 parents fde10a2 + fbc9cbc commit ac212a4
Show file tree
Hide file tree
Showing 6 changed files with 4,897 additions and 8 deletions.
1 change: 0 additions & 1 deletion lib/instrumentation/superagent/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ bower_components
build/Release

# Dependency directories
package-lock.json
node_modules/
jspm_packages/

Expand Down
4 changes: 4 additions & 0 deletions lib/instrumentation/superagent/lib/http-methods.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'use strict'
const http = require('http')
const methodsLower = http.METHODS.map((method) => method.toLowerCase())
module.exports.METHODS = methodsLower
4 changes: 2 additions & 2 deletions lib/instrumentation/superagent/lib/instrumentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

'use strict'

const methods = require('methods')
const { METHODS } = require('./http-methods')

module.exports = function instrument(shim, superagent) {
shim.wrapExport(superagent, function wrapRequest(shim, request) {
Expand All @@ -16,7 +16,7 @@ module.exports = function instrument(shim, superagent) {

const wrapped = shim.wrapReturn(request, wrapSuperAgentReq)
Object.assign(wrapped, request)
shim.wrapReturn(wrapped, methods, wrapSuperAgentReq)
shim.wrapReturn(wrapped, METHODS, wrapSuperAgentReq)

return wrapped
})
Expand Down
Loading

0 comments on commit ac212a4

Please sign in to comment.