• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / supabase-flutter / 28587363812
86%

Build:
DEFAULT BRANCH: main
Ran 02 Jul 2026 11:45AM UTC
Jobs 8
Files 81
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

02 Jul 2026 11:43AM UTC coverage: 85.916%. Remained the same
28587363812

push

github

web-flow
fix(functions): don't lose error status on a non-JSON body labeled JSON (#1507)

## What

`FunctionsClient.invoke()` decoded the response body as JSON whenever
the `Content-Type` was `application/json`. If a response was labeled
JSON but carried a non-JSON body — e.g. an upstream proxy returning an
HTML error page (`500` + `<html>…502 Bad Gateway…</html>` with
`Content-Type: application/json`) — `_isolate.decode` threw a
`FormatException` straight out of `invoke()`. The caller never got a
`FunctionException`, and the HTTP status was lost.

On an error status this now falls back to the raw text when the body
isn't valid JSON, so the status is still reported. It also compares the
media type case-insensitively.

## Why

Two issues in the same block:

1. The `application/json` branch decoded unconditionally, so a
mislabeled non-JSON body turned a `500` into an uncaught
`FormatException` instead of a `FunctionException` with `status: 500`.
This is the same spirit as #1480 (drain the error body into `details`
rather than letting it escape).
2. The media-type match was case-sensitive (`responseType ==
'application/json'`), so `application/JSON` fell through to the raw-text
branch and JSON was handed back as an undecoded `String`. Media types
are case-insensitive per RFC 9110.

Fix: wrap the decode in a `try`/`on FormatException` fallback, and
`.toLowerCase()` the media type. The fallback to raw text is scoped to
error statuses only: on a `2xx` the `application/json` label is a
promise of structured data, so a body that doesn't parse is a real
anomaly and the `FormatException` is rethrown rather than silently
degrading to a `String`. The narrow `FormatException` catch also
preserves existing behavior (e.g. a disposed isolate still surfaces its
`StateError`).

## Not a breaking change

Valid JSON responses decode exactly as before, and a malformed body on a
success status still throws as it always did. Only two cases change: a
mislabeled non-JSON body on an **... (continued)

9 of 9 new or added lines in 1 file covered. (100.0%)

4203 of 4892 relevant lines covered (85.92%)

3.94 hits per line

Jobs
ID Job ID Ran Files Coverage
7 supabase - 28587363812.7 02 Jul 2026 11:45AM UTC 15
81.8
GitHub Action Run
8 supabase_flutter - 28587363812.8 02 Jul 2026 11:45AM UTC 11
79.26
GitHub Action Run
8 storage_client - 28533236058.8 01 Jul 2026 04:46PM UTC 5
92.98
GitHub Action Run
8 gotrue - 28536394514.8 01 Jul 2026 05:43PM UTC 27
84.74
GitHub Action Run
3 yet_another_json_isolate - 28433368938.3 30 Jun 2026 09:12AM UTC 1
79.03
GitHub Action Run
8 realtime_client - 28583270853.8 02 Jul 2026 10:32AM UTC 11
88.82
GitHub Action Run
5 postgrest - 28536394514.5 01 Jul 2026 05:43PM UTC 9
84.31
GitHub Action Run
7 functions_client - 28444889808.7 30 Jun 2026 12:39PM UTC 2
98.57
GitHub Action Run
Source Files on build 28587363812
  • Tree
  • List 81
  • Changed 5
  • Source Changed 4
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #28587363812
  • 925b46e1 on github
  • Prev Build on main (#28583270853)
  • Next Build on main (#28588548625)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc