Skip to content

Commit c9e485c

Browse files
authored
Merge pull request #1 from Kaifungamedev/main
exposed raw body bytes.
2 parents b6ca324 + 0e97ead commit c9e485c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

AwaitableHTTPRequest.gd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class HTTPResult extends RefCounted:
1515

1616
var status_code: int ## The response status code.
1717
var headers: Dictionary ## The response headers.
18-
var body: String ## The response body.
18+
var body: String ## The response body as a String.
19+
var body_raw: PackedByteArray ## The response body as a PackedByteArray.
1920
var json: Variant: ## Attempt to parse [member body] into a [Dictionary] or [Array], returns null on failure.
2021
set(v): pass
2122
get: return JSON.parse_string(body)
@@ -33,6 +34,7 @@ class HTTPResult extends RefCounted:
3334
@warning_ignore('unsafe_cast') h.status_code = a[1] as int
3435
@warning_ignore('unsafe_cast') h.headers = _headers_to_dict(a[2] as PackedStringArray)
3536
@warning_ignore('unsafe_cast') h.body = (a[3] as PackedByteArray).get_string_from_utf8()
37+
@warning_ignore('unsafe_cast') h.body_raw = (a[3] as PackedByteArray)
3638
return h
3739

3840
static func _headers_to_dict(headers_arr: PackedStringArray) -> Dictionary:

0 commit comments

Comments
 (0)