Skip to content
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

Add e2e proxy tests for query parameters. #3827

Merged
merged 6 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 14 additions & 0 deletions spec/e2e/proxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@ def browser
expect(browser.div(id: 'test-div').present?).to be true
end

it 'correctly passes query parameters to node URIs' do
url = "#{ctr_base_url}/node/localhost/5001/one/with-query-params?artist=the%20beatles&album=let%20it%20be"
browser.goto(url)
expect(browser.url).to eq(url)
expect(browser.div(id: 'test-div').present?).to be true
end

it 'correctly passes query parameters to rnode URIs' do
url = "#{ctr_base_url}/rnode/localhost/5000/one/with-query-params?artist=the%20beatles&album=let%20it%20be"
browser.goto(url)
expect(browser.url).to eq(url)
expect(browser.div(id: 'test-div').present?).to be true
end

it '/nginx/init needs a redirect' do
url = "#{ctr_base_url}/nginx/init"
browser.goto url
Expand Down
11 changes: 11 additions & 0 deletions spec/fixtures/extras/simple_origin_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ def one_level_relative_redirect():
def one_level_down():
return "<html><body><div id='test-div'>A very simple page for testing</div></body></html>"

@app.route("/one/with-query-params")
def one_level_down_with_query_params():
artist = request.args.get('artist')
album = request.args.get('album')
print("artist: {} album: {}".format(artist, album))

if artist is None or album is None:
return 'You need to supply artist and album query parameters.', 404
else:
return one_level_down()

@app.route("/simple-redirect")
def simple_redirect():
return redirect(url_for('app.simple_page'), code=302)
Expand Down
Loading