Skip to content
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
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.5
2.3.6
13 changes: 10 additions & 3 deletions src/classes/baserow/baserow.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ public function get(array $data = []): array
return [];
}

curl_setopt($handle, CURLOPT_HTTPHEADER, array(sprintf("Authorization: Token %s", $this->token)));
curl_setopt($handle, CURLOPT_HTTPHEADER, array(
sprintf("Authorization: Token %s", $this->token)
));
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);

// make request and return empty array on error
$json = Curl::execute_with_retry($handle);
Expand Down Expand Up @@ -178,6 +181,9 @@ public function post(array $data): Post_Result
curl_setopt($handle, CURLOPT_HTTPHEADER, array(
sprintf("Authorization: Token %s", $this->token)
));
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, $form);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);

// make request and output on error
$json = Curl::execute_with_retry($handle);
Expand All @@ -188,8 +194,9 @@ public function post(array $data): Post_Result

// decode JSON response and output on error
$result = json_decode($json, true);
if ($error = Arr::get_array($result, "error")) {
return new Post_Result(400, Arr::get($error, "detail"));
if ($error = Arr::get($result, "error")) {
$detail = is_array($error) ? Arr::get($error, "detail") : $error;
return new Post_Result(400, $detail);
}

// if we get here the POST was successful
Expand Down
Loading