diff options
author | Timmy Willison <timmywil@users.noreply.github.com> | 2024-08-08 22:10:29 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-08 22:10:29 -0400 |
commit | c85454a84306677efda3286a3214419bff945849 (patch) | |
tree | 1e61bd177ff5ec9267078856e16361aac72ffcdd /test/middleware-mockserver.cjs | |
parent | 7e6cee72e2e4d144f4e3fc6d46db9251d38c6fc2 (diff) | |
download | jquery-c85454a84306677efda3286a3214419bff945849.tar.gz jquery-c85454a84306677efda3286a3214419bff945849.zip |
Tests: replace express with basic Node server
Close gh-5527
Diffstat (limited to 'test/middleware-mockserver.cjs')
-rw-r--r-- | test/middleware-mockserver.cjs | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/test/middleware-mockserver.cjs b/test/middleware-mockserver.cjs index 0b513f042..73aaa5656 100644 --- a/test/middleware-mockserver.cjs +++ b/test/middleware-mockserver.cjs @@ -179,16 +179,7 @@ const mocks = { "constructor": "prototype collision (constructor)" }; - // Use resp.append in express to - // avoid overwriting List-Header - if ( resp.append ) { - - for ( const key in headers ) { - resp.append( key, headers[ key ] ); - } - } else { - resp.writeHead( 200, headers ); - } + resp.writeHead( 200, headers ); req.query.keys.split( "|" ).forEach( function( key ) { if ( key.toLowerCase() in req.headers ) { resp.write( `${ key }: ${ req.headers[ key.toLowerCase() ] }\n` ); @@ -348,11 +339,7 @@ const handlers = { /** * Connect-compatible middleware factory for mocking server responses. - * Used by Ajax unit tests when run via Karma. - * - * Despite Karma using Express, it uses Connect to deal with custom middleware, - * which passes the raw Node Request and Response objects instead of the - * Express versions of these (e.g. no req.path, req.query, resp.set). + * Used by Ajax tests run in Node. */ function MockserverMiddlewareFactory() { |