Skip to content

Commit

Permalink
Merge pull request #549 from timholy/teh/stringify
Browse files Browse the repository at this point in the history
Eliminate type-piracy in `string`
  • Loading branch information
quinnj authored Jun 30, 2020
2 parents f3a08d7 + 213dc6c commit 971312f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/CookieRequest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function request(::Type{CookieLayer{Next}},
end
end
if !isempty(cookiestosend)
setkv(headers, "Cookie", string(getkv(headers, "Cookie", ""), cookiestosend))
setkv(headers, "Cookie", stringify(getkv(headers, "Cookie", ""), cookiestosend))
end

res = request(Next, method, url, headers, body; kw...)
Expand Down
4 changes: 2 additions & 2 deletions src/cookies.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

module Cookies

export Cookie, cookies
export Cookie, cookies, stringify

import Base: ==
using ..Dates
Expand Down Expand Up @@ -119,7 +119,7 @@ function Base.String(c::Cookie, isrequest::Bool=true)
return String(take!(io))
end

function Base.string(cookiestring::String, cookies::Vector{Cookie}, isrequest::Bool=true)
function stringify(cookiestring::String, cookies::Vector{Cookie}, isrequest::Bool=true)
io = IOBuffer()
!isempty(cookiestring) && write(io, cookiestring, cookiestring[end] == ';' ? "" : ";")
len = length(cookies)
Expand Down
2 changes: 1 addition & 1 deletion test/cookies.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
HTTP.Cookie("cookie-2", "v\$2"),
HTTP.Cookie("cookie-3", "v\$3"),
]
@test string("", cookies) == "cookie-1=v\$1; cookie-2=v\$2; cookie-3=v\$3"
@test HTTP.stringify("", cookies) == "cookie-1=v\$1; cookie-2=v\$2; cookie-3=v\$3"
end

@testset "readsetcookies" begin
Expand Down

0 comments on commit 971312f

Please sign in to comment.