Skip to content

Commit

Permalink
Fix DataURI construction with default mediatype
Browse files Browse the repository at this point in the history
  • Loading branch information
s-celles committed Mar 12, 2024
1 parent 27507e4 commit 50055d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/data_uri.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct DataURI

end

function DataURI(; mediatype=MIME"text/plain", encoded=false, data="", parameters=Pair{String, String}[])
function DataURI(; mediatype=MIME("text/plain"), encoded=false, data="", parameters=Pair{String, String}[])
base64 = encoded ? ";base64" : ""
s_parameters = ""
for (key, value) in parameters
Expand Down
5 changes: 5 additions & 0 deletions test/data_uri.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ const brief_note = "data:,A%20brief%20note"
@test data_uri.uri == greek_characters
end

@testset "greek_characters using default mediatype" begin
data_uri = DataURI(; data="%be%fg%be", parameters=["charset" => "iso-8859-7"])
@test data_uri.uri == greek_characters
end

@testset "brief_note" begin
data_uri = DataURI(; mediatype=MIME(""), data="A%20brief%20note")
@test data_uri.uri == brief_note
Expand Down

0 comments on commit 50055d8

Please sign in to comment.