Skip to content

gh-135056: Add a --cors CLI argument to http.server #135057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
gh-135056: Remove some commented out and unused code.
  • Loading branch information
aisipos committed Jul 15, 2025
commit 9450b868516e80d775449b7f496795e127ef3e42
1 change: 0 additions & 1 deletion Lib/http/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,6 @@ def _main(args=None):
help='bind to this port '
'(default: %(default)s)')
parser.add_argument('-H', '--header', nargs=2, action='append',
# metavar='HEADER VALUE',
metavar=('HEADER', 'VALUE'),
help='Add a custom response header '
'(can be used multiple times)')
Expand Down
10 changes: 1 addition & 9 deletions Lib/test/test_httpservers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1490,15 +1490,7 @@ def test_unknown_flag(self, _):
self.assertIn('error', stderr.getvalue())

def test_response_headers_arg(self):
# with mock.patch.object(
# SimpleHTTPRequestHandler, '__init__'
# ) as mock_handler, \
# mock.patch.object(
# HTTPServer, 'serve_forever'
# ) as mock_serve_forever:
with mock.patch.object(
HTTPServer, 'serve_forever'
) as mock_serve_forever:
with mock.patch.object(HTTPServer, 'serve_forever'):
httpd = server._main(
['-H', 'Set-Cookie', 'k=v', '-H', 'Set-Cookie', 'k2=v2', '8080']
)
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy