Skip to content

Commit

Permalink
fix compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
stakach committed Aug 5, 2019
1 parent c58762e commit 6ba2ec4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion spec/base_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe ActionController::Base do
{"id" => "Weird%!"},
param1: "woot woot!",
param2: false
).should eq("/hello/Weird%25%21?param1=woot+woot%21&param2=false")
).should eq("/hello/Weird%25!?param1=woot+woot%21&param2=false")
end

it "should raise a BadRoute error if a route param is missing" do
Expand Down
4 changes: 2 additions & 2 deletions spec/session_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe ActionController::Session do
session.encode(cookies)

cookies[key].value.should be_empty
cookies[key].expires.as(Time).should be_close(Time.now, 0.1.seconds)
cookies[key].expires.as(Time).should be_close(Time.utc, 0.1.seconds)
end
end

Expand All @@ -31,7 +31,7 @@ describe ActionController::Session do
cookies = HTTP::Cookies.new
session.encode(cookies)

cookies[key].expires.as(Time).should be_close(Time.now + age, 0.1.seconds)
cookies[key].expires.as(Time).should be_close(Time.utc + age, 0.1.seconds)
encoder.extract(cookies[key].value).should eq(%({"key":"#{"a" * 3013}"}))
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.cr
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class HelloWorld < Application

def show
raise "set_var was set!" if @me
res = 42 / params["id"].to_i
res = 42 // params["id"].to_i
render text: "42 / #{params["id"]} = #{res}"
end

Expand Down
2 changes: 1 addition & 1 deletion src/action-controller/session.cr
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ActionController::Session < Hash(String, String | Int64 | Float64 | Bool)
settings.key,
data,
settings.path,
Time.now + age.seconds,
Time.utc + age.seconds,
@domain,
settings.secure,
http_only: true,
Expand Down
4 changes: 2 additions & 2 deletions src/action-controller/support.cr
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module ActionController::Support
value = value.to_s

if keys.includes?(key)
route = route.gsub(":#{key}", URI.escape(value))
route = route.gsub(":#{key}", URI.encode(value))
keys.delete(key)
else
params[key] = value
Expand All @@ -44,7 +44,7 @@ module ActionController::Support
value = value.to_s

if keys.includes?(key)
route = route.gsub(":#{key}", URI.escape(value))
route = route.gsub(":#{key}", URI.encode(value))
keys.delete(key)
else
params[key] = value
Expand Down

0 comments on commit 6ba2ec4

Please sign in to comment.