diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-05-22 16:01:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-22 16:01:00 +0200 |
commit | f9e45114b9c423b72e9c44c4a8aef90f5c3b44d6 (patch) | |
tree | b8e4c4f8586b116f1a1bb04cd10ceb6e2cd1cdeb /tools/http_server.py | |
parent | ee710994925e8840ea387e1853d9c15f3eb73149 (diff) |
fix: redirects handling in module analysis (#5726)
This commit fixes a bug introduced in #5029 that caused bad
handling of redirects during module analysis.
Also ensured that duplicate modules are not downloaded.
Diffstat (limited to 'tools/http_server.py')
-rwxr-xr-x | tools/http_server.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/http_server.py b/tools/http_server.py index e2e9f2d98..346b319f8 100755 --- a/tools/http_server.py +++ b/tools/http_server.py @@ -122,6 +122,34 @@ class ContentTypeHandler(QuietSimpleHTTPRequestHandler): self.wfile.write(bytes("export const foo = 'foo';")) return + if "type_directives_redirect.js" in self.path: + self.protocol_version = "HTTP/1.1" + self.send_response(200, 'OK') + self.send_header('Content-type', 'application/javascript') + self.send_header( + 'X-TypeScript-Types', + 'http://localhost:4547/xTypeScriptTypesRedirect.d.ts') + self.end_headers() + self.wfile.write(bytes("export const foo = 'foo';")) + return + + if "xTypeScriptTypesRedirect.d.ts" in self.path: + self.protocol_version = "HTTP/1.1" + self.send_response(200, 'OK') + self.send_header('Content-type', 'application/typescript') + self.end_headers() + self.wfile.write( + bytes("import './xTypeScriptTypesRedirected.d.ts';")) + return + + if "xTypeScriptTypesRedirected.d.ts" in self.path: + self.protocol_version = "HTTP/1.1" + self.send_response(200, 'OK') + self.send_header('Content-type', 'application/typescript') + self.end_headers() + self.wfile.write(bytes("export const foo: 'foo';")) + return + if "xTypeScriptTypes.d.ts" in self.path: self.protocol_version = "HTTP/1.1" self.send_response(200, 'OK') |