We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 3435640 + 12d77d6 commit b1ed626Copy full SHA for b1ed626
2 files changed
lib/github/auth/keys_client.rb
@@ -1,3 +1,4 @@
1
+require 'cgi'
2
require 'httparty'
3
4
module Github::Auth
@@ -21,7 +22,7 @@ def initialize(options = {})
21
22
options = DEFAULT_OPTIONS.merge options
23
raise UsernameRequiredError unless options.fetch :username
24
- @username = options.fetch :username
25
+ @username = CGI.escape(options.fetch :username)
26
@hostname = options.fetch :hostname
27
end
28
spec/unit/github/auth/keys_client_spec.rb
@@ -33,6 +33,11 @@
33
keys_client = described_class.new username: username
34
expect(keys_client.username).to eq username
35
36
+
37
+ it 'url escapes the username' do
38
+ keys_client = described_class.new username: 'spaces are !o.k.'
39
+ expect(keys_client.username).to eq 'spaces+are+%21o.k.'
40
+ end
41
42
43
describe '#keys' do
0 commit comments