Skip to content

Commit

Permalink
Merge pull request #229 from mamantoha/fix-resource-concat_urls
Browse files Browse the repository at this point in the history
fix Crest::Resource#concat_urls
  • Loading branch information
mamantoha authored Jul 29, 2024
2 parents 3dcb6c5 + c3013fe commit de62d38
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 17 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [...]

- Fix Crest::Resource#concat_urls [#229](https://github.com/mamantoha/crest/pull/229)

## [1.4.0][] (2024-08-26)

- Fix typo in README.md by @kojix2 in [#223](https://github.com/mamantoha/crest/pull/223)
Expand Down
1 change: 0 additions & 1 deletion src/crest.cr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ require "./ext/io"
require "./ext/int"
require "./ext/float"
require "./ext/http/cookie"
require "./ext/uri"

# This module's static methods are the entry point for using the Crest client.
#
Expand Down
7 changes: 5 additions & 2 deletions src/crest/resource.cr
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,11 @@ module Crest
other
end

private def concat_urls(url : String, suburl : String) : String
URI.join(url, URI.parse(suburl)).to_s
private def concat_urls(base_url : String, path : String) : String
base_url = base_url.ends_with?('/') ? base_url[...-1] : base_url
path = path.starts_with?('/') ? path[1..] : path

[base_url, path].join('/')
end
end
end
14 changes: 0 additions & 14 deletions src/ext/uri.cr

This file was deleted.

0 comments on commit de62d38

Please sign in to comment.