Azure.jl
Azure.jl copied to clipboard
ServiceRequest constructor doesn't accept AbstractVector
https://github.com/JuliaComputing/Azure.jl/blob/a5b64f01d9784904c1008e82ba5c784e6d3831cf/src/rest_api_protocol.jl#L54-L56
This constructor (and probably almost all functions) that takes a Vector{UInt8} should really be taking an AbstractVector{UInt8}. As it is currently defined, you will get a MethodError if you construct with e.g. codeunits("foo"):
julia> req = Azure.REST.ServiceRequest("account", "PUT", "url", codeunits("hello"))
ERROR: MethodError: no method matching Azure.REST.ServiceRequest(::String, ::String, ::String, ::Base.CodeUnits{UInt8, String})
Closest candidates are:
Azure.REST.ServiceRequest(::String, ::String, ::String) at ~/.julia/packages/Azure/YzOHB/src/rest_api_protocol.jl:62
Azure.REST.ServiceRequest(::String, ::String, ::String, ::Union{Nothing, IO}; headers...) at ~/.julia/packages/Azure/YzOHB/src/rest_api_protocol.jl:62
Azure.REST.ServiceRequest(::String, ::String, ::String, ::AbstractString; headers...) at ~/.julia/packages/Azure/YzOHB/src/rest_api_protocol.jl:58
...
Stacktrace:
[1] top-level scope
@ REPL[5]:1
This is a regression from v0.3.1, where this worked correctly:
julia> req = Azure.REST.ServiceRequest("account", "PUT", "url", codeunits("hello"))
Azure.REST.ServiceRequest("account", "PUT", "url", Azure.REST.StandardHeaders(nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothin
g, nothing, nothing), Dict("x-ms-date" => "Wed, 13 Jul 2022 13:14:39 GMT", "x-ms-version" => "2016-05-31"), UInt8[0x68, 0x65, 0x6c, 0x6c, 0x6f])
julia> @which Azure.REST.ServiceRequest("account", "PUT", "url", codeunits("hello"))
Azure.REST.ServiceRequest(account::String, verb::String, resource::String, data; headers...) in Azure.REST at /Users/nathandaly/.julia/packages/Azure/ZwCcU/
src/rest_api_protocol.jl:48
note that you should be able to construct an IOBuffer this way:
julia> IOBuffer(codeunits("hello"))
IOBuffer(data=UInt8[...], readable=true, writable=false, seekable=true, append=false, size=5, maxsize=Inf, ptr=1, mark=-1)