mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
test: fix test_check_origin_not_supported (#18504)
Merge of dotland and dotcom caused this test to fail.
This commit is contained in:
parent
8497cef156
commit
c385678d66
6 changed files with 5 additions and 231 deletions
|
@ -1675,16 +1675,17 @@ mod tests {
|
|||
let module_registry =
|
||||
ModuleRegistry::new(&location, HttpClient::new(None, None).unwrap())
|
||||
.unwrap();
|
||||
let result = module_registry.check_origin("https://deno.com").await;
|
||||
let result = module_registry.check_origin("https://example.com").await;
|
||||
assert!(result.is_err());
|
||||
let err = result.unwrap_err().to_string();
|
||||
assert!(err
|
||||
.contains("https://deno.com/.well-known/deno-import-intellisense.json"));
|
||||
assert!(err.contains(
|
||||
"https://example.com/.well-known/deno-import-intellisense.json"
|
||||
));
|
||||
|
||||
// because we are caching an empty file when we hit an error with import
|
||||
// detection when fetching the config file, we should have an error now that
|
||||
// indicates trying to parse an empty file.
|
||||
let result = module_registry.check_origin("https://deno.com").await;
|
||||
let result = module_registry.check_origin("https://example.com").await;
|
||||
assert!(result.is_err());
|
||||
let err = result.unwrap_err().to_string();
|
||||
assert!(err.contains("EOF while parsing a value at line 1 column 0"));
|
||||
|
|
|
@ -347,10 +347,6 @@
|
|||
"test-http-outgoing-message-inheritance.js",
|
||||
"test-http-outgoing-renderHeaders.js",
|
||||
"test-http-outgoing-settimeout.js",
|
||||
"test-http-url.parse-auth.js",
|
||||
"test-http-url.parse-path.js",
|
||||
"test-http-url.parse-post.js",
|
||||
"test-http-url.parse-search.js",
|
||||
"test-net-access-byteswritten.js",
|
||||
"test-net-better-error-messages-listen-path.js",
|
||||
"test-net-better-error-messages-path.js",
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 18.12.1
|
||||
// This file is automatically generated by "node/_tools/setup.ts". Do not modify this file manually
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
const http = require('http');
|
||||
const url = require('url');
|
||||
|
||||
function check(request) {
|
||||
// The correct authorization header is be passed
|
||||
assert.strictEqual(request.headers.authorization, 'Basic dXNlcjpwYXNzOg==');
|
||||
}
|
||||
|
||||
const server = http.createServer(function(request, response) {
|
||||
// Run the check function
|
||||
check(request);
|
||||
response.writeHead(200, {});
|
||||
response.end('ok');
|
||||
server.close();
|
||||
});
|
||||
|
||||
server.listen(0, function() {
|
||||
const port = this.address().port;
|
||||
// username = "user", password = "pass:"
|
||||
const testURL = url.parse(`http://user:pass%3A@localhost:${port}`);
|
||||
|
||||
// make the request
|
||||
http.request(testURL).end();
|
||||
});
|
|
@ -1,53 +0,0 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 18.12.1
|
||||
// This file is automatically generated by "node/_tools/setup.ts". Do not modify this file manually
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
const http = require('http');
|
||||
const url = require('url');
|
||||
|
||||
function check(request) {
|
||||
// A path should come over
|
||||
assert.strictEqual(request.url, '/asdf');
|
||||
}
|
||||
|
||||
const server = http.createServer(function(request, response) {
|
||||
// Run the check function
|
||||
check(request);
|
||||
response.writeHead(200, {});
|
||||
response.end('ok');
|
||||
server.close();
|
||||
});
|
||||
|
||||
server.listen(0, function() {
|
||||
const testURL = url.parse(`http://localhost:${this.address().port}/asdf`);
|
||||
|
||||
// make the request
|
||||
http.request(testURL).end();
|
||||
});
|
|
@ -1,61 +0,0 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 18.12.1
|
||||
// This file is automatically generated by "node/_tools/setup.ts". Do not modify this file manually
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
const http = require('http');
|
||||
const url = require('url');
|
||||
|
||||
let testURL;
|
||||
|
||||
function check(request) {
|
||||
// url.parse should not mess with the method
|
||||
assert.strictEqual(request.method, 'POST');
|
||||
// Everything else should be right
|
||||
assert.strictEqual(request.url, '/asdf?qwer=zxcv');
|
||||
// The host header should use the url.parse.hostname
|
||||
assert.strictEqual(request.headers.host,
|
||||
`${testURL.hostname}:${testURL.port}`);
|
||||
}
|
||||
|
||||
const server = http.createServer(function(request, response) {
|
||||
// Run the check function
|
||||
check(request);
|
||||
response.writeHead(200, {});
|
||||
response.end('ok');
|
||||
server.close();
|
||||
});
|
||||
|
||||
server.listen(0, function() {
|
||||
testURL = url.parse(`http://localhost:${this.address().port}/asdf?qwer=zxcv`);
|
||||
testURL.method = 'POST';
|
||||
|
||||
// make the request
|
||||
http.request(testURL).end();
|
||||
});
|
|
@ -1,54 +0,0 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 18.12.1
|
||||
// This file is automatically generated by "node/_tools/setup.ts". Do not modify this file manually
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
const http = require('http');
|
||||
const url = require('url');
|
||||
|
||||
function check(request) {
|
||||
// A path should come over with params
|
||||
assert.strictEqual(request.url, '/asdf?qwer=zxcv');
|
||||
}
|
||||
|
||||
const server = http.createServer(function(request, response) {
|
||||
// Run the check function
|
||||
check(request);
|
||||
response.writeHead(200, {});
|
||||
response.end('ok');
|
||||
server.close();
|
||||
});
|
||||
|
||||
server.listen(0, function() {
|
||||
const port = this.address().port;
|
||||
const testURL = url.parse(`http://localhost:${port}/asdf?qwer=zxcv`);
|
||||
|
||||
// make the request
|
||||
http.request(testURL).end();
|
||||
});
|
Loading…
Reference in a new issue