Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce HTTPExt package extension #403

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
name = "FileIO"
uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
version = "1.16.5"
version = "1.16.6"

[deps]
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[weakdeps]
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"

[extensions]
HTTPExt = "HTTP"

[compat]
Pkg = "<0.0.1, 0.7, 1"
Requires = "1"
Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ PNGFiles = "f57f5aa1-a3ce-4bc8-8ab9-96f992907883"

[compat]
Documenter = "1"
HTTP = "0.9"
HTTP = "0.9, 1"
13 changes: 13 additions & 0 deletions ext/HTTPExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module HTTPExt

if isdefined(Base, :get_extension)
using FileIO
using HTTP
else
using ..FileIO
using ..HTTP
end

FileIO.load(uri::HTTP.URI) = load(IOBuffer(HTTP.get(uri).body))

end # module
4 changes: 3 additions & 1 deletion src/FileIO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@
"""
FileIO

@static if !isdefined(Base, :get_extension)
function __init__()
@require HTTP="cd3eb016-35fb-5094-929b-558a96fad6f3" begin
load(uri::HTTP.URI) = load(IOBuffer(HTTP.get(uri).body))
include("../ext/HTTPExt.jl")

Check warning on line 70 in src/FileIO.jl

View check run for this annotation

Codecov / codecov/patch

src/FileIO.jl#L70

Added line #L70 was not covered by tests
end
end
end # @static

if VERSION >= v"1.4.2" # https://github.com/JuliaLang/julia/pull/35378
include("precompile.jl")
Expand Down
Loading