Skip to content

Task: Reinforce API Server Fetch #133

@n3rdc4ptn

Description

@n3rdc4ptn

Understand the Task

Description
We need to reinforce the fetchApiServer method in https://github.com/openmcp-project/ui-frontend/blob/00d740e8339d9c5706c64a60b4b22055dc95e6ed/src/lib/api/fetch.ts#L54C5-L59C17.

Currently we optimistically parse to json. As sometimes the API server could answer with just text (plain/text) we should check the Content-Type before we parse the body.

We also need to proper handle occurring errors in that spot. So a well written try/catch is needed.

Any further valuable resources.

  1. MCPs without flux installed,
  2. answer on the flux endpoints with text 404 page not found.
    Preferred: lets use defensive try-catch block for JSON and use text alternatively

Optional: The Content-Type header in the response is: content-type: text/plain; charset=utf-8

What is required to accept the Task as done.

Done Criteria

  • Catch possible errors, when parsing and handle them
  • Check Content-Type before we parse it.
  • parse Content accordingly (application/json, text/plain, ....)
  • in the component where error is shown we no longer see JSon parsing issues

Metadata

Metadata

Assignees

Labels

area/mcp-uiAll ManagedControlPlane UI related issueskind/taskGeneral task that needs to be done.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions