summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Azzopardi <steveazz@outlook.com>2018-07-24 14:05:48 +0200
committerSteve Azzopardi <steveazz@outlook.com>2018-07-25 08:53:51 +0200
commit0444affc1cca7253066e741aaad4ff266132ecd5 (patch)
tree6dad9755721146e63ecab54ee6a5ec7876edc72a
parent4bbfe53175f9e7b85bcb0da4530d717c90370308 (diff)
downloadgitlab-ce-25990-interactive-web-terminals-authorization.tar.gz
Fix authorization for web terminals25990-interactive-web-terminals-authorization
Workhorse was not able to parse the `headers` property since it was expecting a key => array as a structure. Error from workhorse: preAuthorizeHandler: decode authorization response: json: cannot unmarshal string into Go struct field TerminalSettings.Header of type []string Workhorse was not changed since this api is already used for the environment terminals. gitlab-org/gitlab-ce#25990
-rw-r--r--app/models/ci/build_runner_session.rb2
-rw-r--r--spec/models/ci/build_runner_session_spec.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/models/ci/build_runner_session.rb b/app/models/ci/build_runner_session.rb
index 6f3be31d8e1..869dc0ccadf 100644
--- a/app/models/ci/build_runner_session.rb
+++ b/app/models/ci/build_runner_session.rb
@@ -17,7 +17,7 @@ module Ci
{
subprotocols: ['terminal.gitlab.com'].freeze,
url: "#{url}/exec".sub("https://", "wss://"),
- headers: { Authorization: authorization.presence }.compact,
+ headers: { Authorization: [authorization.presence] }.compact,
ca_pem: certificate.presence
}
end
diff --git a/spec/models/ci/build_runner_session_spec.rb b/spec/models/ci/build_runner_session_spec.rb
index 7183957aa50..35622366829 100644
--- a/spec/models/ci/build_runner_session_spec.rb
+++ b/spec/models/ci/build_runner_session_spec.rb
@@ -29,7 +29,7 @@ describe Ci::BuildRunnerSession, model: true do
it 'adds Authorization header if authorization is present' do
subject.authorization = 'whatever'
- expect(terminal_specification[:headers]).to include(Authorization: 'whatever')
+ expect(terminal_specification[:headers]).to include(Authorization: ['whatever'])
end
end
end