File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,12 @@ describe "Initialize" do
18
18
object.headers[" X-API-Key" ].should eq(" abcdssss" )
19
19
end
20
20
21
+ it " Deliver with headers (bearer case)" do
22
+ options[:send_with_headers ] = " Authorization: Bearer gAAAAABl3qwaQqol243Np"
23
+ object = Deliver .new options
24
+ object.headers[" Authorization" ].should eq(" Bearer gAAAAABl3qwaQqol243Np" )
25
+ end
26
+
21
27
it " Deliver with matchers" do
22
28
options[:use_matchers ] = " /admin"
23
29
object = Deliver .new options
Original file line number Diff line number Diff line change @@ -26,7 +26,18 @@ class Deliver
26
26
if header.includes? " :"
27
27
@logger .debug " Adding '#{ header } ' to headers."
28
28
splited = header.split(" :" )
29
- @headers [splited[0 ]] = splited[1 ].gsub(/\s / , " " )
29
+ value = " "
30
+ begin
31
+ if splited[1 ][0 ].to_s == " "
32
+ value = splited[1 ][1 ..- 1 ].to_s
33
+ else
34
+ value = splited[1 ].to_s
35
+ end
36
+ rescue
37
+ value = splited[1 ].to_s
38
+ end
39
+
40
+ @headers [splited[0 ]] = value
30
41
end
31
42
end
32
43
@logger .info_sub " #{ @headers .size} headers added."
You can’t perform that action at this time.
0 commit comments