Skip to content

Commit

Permalink
Convert bytestream directly to String rather than one byte at a time …
Browse files Browse the repository at this point in the history
…so that we correctly handle UTF-8 characters
  • Loading branch information
bluesmoon committed Apr 1, 2022
1 parent cf530cb commit 07330e7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "mPulseAPI"
uuid = "314d2b54-f2c3-11ea-15f2-0bcf2fc50b35"
authors = ["Akamai mPulse DSWB <[email protected]>"]
version = "1.1.1"
version = "1.1.2"

[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Expand Down
4 changes: 2 additions & 2 deletions src/RepositoryAPI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -488,10 +488,10 @@ function getHttpRequest(token::AbstractString, objectType::AbstractString, searc
throw(mPulseAPIException("Error fetching $(objectType) $(debugID)", resp))
end

json = join(map(Char, resp.body))
json = String(resp.body)
object = JSON.parse(json)

# If calling by a searchKey other than ID, the return value will be a Dict with a single key="objects"
# If calling by a searchKey other than ID, the return value will be a Dict with a single key="objects"
# and value set to an array of domain objects.
# If searching by ID, then the object is returned, so turn it into an array
if haskey(object, "objects") && isa(object["objects"], Array)
Expand Down
6 changes: 3 additions & 3 deletions src/exceptions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct mPulseAPIException <: Exception
response::HTTP.Response
responseBody::AbstractString

mPulseAPIException(msg::AbstractString, response::HTTP.Response) = new(msg, response, join(map(Char, response.body)))
mPulseAPIException(msg::AbstractString, response::HTTP.Response) = new(msg, response, String(response.body))
end

"""
Expand All @@ -46,7 +46,7 @@ struct mPulseAPIAuthException <: Exception
response::HTTP.Response
responseBody::AbstractString

mPulseAPIAuthException(response::HTTP.Response) = new("Error Authenticating with REST API", response, join(map(Char, response.body)))
mPulseAPIAuthException(response::HTTP.Response) = new("Error Authenticating with REST API", response, String(response.body))
end

"""
Expand Down Expand Up @@ -112,5 +112,5 @@ struct mPulseAPIBugException <: Exception
response::HTTP.Response
responseBody::AbstractString

mPulseAPIBugException(resp::HTTP.Response) = new("Internal Server Error, please report this. Timestamp: $(round(Int, datetime2unix(now())))", resp, join(map(Char, resp.body)))
mPulseAPIBugException(resp::HTTP.Response) = new("Internal Server Error, please report this. Timestamp: $(round(Int, datetime2unix(now())))", resp, String(resp.body))
end

0 comments on commit 07330e7

Please sign in to comment.