Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: crystal-lang/crystal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7ac9a53f2774
Choose a base ref
...
head repository: crystal-lang/crystal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 27512525b1b4
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Aug 14, 2016

  1. Verified

    This commit was signed with the committer’s verified signature.
    headius Charles Oliver Nutter
    Copy the full SHA
    bcabaef View commit details
  2. Merge pull request #3153 from jhass/http_request_path

    HTTP::Request#path: fallback to /
    ysbaddaden authored Aug 14, 2016
    Copy the full SHA
    2751252 View commit details
Showing with 7 additions and 1 deletion.
  1. +6 −0 spec/std/http/request_spec.cr
  2. +1 −1 src/http/request.cr
6 changes: 6 additions & 0 deletions spec/std/http/request_spec.cr
Original file line number Diff line number Diff line change
@@ -168,6 +168,12 @@ module HTTP
request = Request.from_io(MemoryIO.new("GET /api/v3/some/resource?filter=hello&world=test HTTP/1.1\r\n\r\n")).as(Request)
request.path.should eq("/api/v3/some/resource")
end

it "falls back to /" do
request = Request.new("GET", "/foo")
request.path = nil
request.path.should eq("/")
end
end

describe "#path=" do
2 changes: 1 addition & 1 deletion src/http/request.cr
Original file line number Diff line number Diff line change
@@ -77,7 +77,7 @@ class HTTP::Request

# Lazily parses and return the request's path component.
def path
uri.path
uri.path || "/"
end

# Sets request's path component.