Skip to content

Unhandled Exception: Error on line 1, column 13: expected no more input. max-age=1.00:00:00 #361

@Ram8948

Description

@Ram8948

Flutter & ArcGIS SDK Tip: Fixing Non-Standard Cache-Control Header Parsing for Enterprise Services

During development with ArcGIS Maps SDK for Flutter (arcgis_maps 200.8.0+4672), I hit a frustrating exception:
Unhandled Exception: Error on line 1, column 13: expected no more input.
max-age=1.00:00:00

What happened?
The ArcGIS Enterprise server returned a non-standard Cache-Control header with a max-age value formatted as 1.00:00:00 (day.hour:min:sec), which doesn’t conform to HTTP specs expecting seconds as an integer.
This caused Flutter's HTTP cache parser to crash.

How I fixed it:
I intercepted the Cache-Control header in my Flutter Dio client and transformed these invalid max-age values into the correct number of seconds. Key parts of the fix:

Added a regex to recognize durations like max-age=1.00:00:00.
Parsed the days, hours, minutes, and seconds and converted them into seconds.
Replaced the header value with max-age=86400 (for 1 day).
This happens before the cache parsing, preventing the exception.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions