Projekt

Allgemein

Profil

Aktionen

GX-Task #65345

offen

Updating Slim dependency | Breaking changes for the REST API v2

Von Mirko Janssen vor etwa 5 Jahren hinzugefügt. Vor mehr als 3 Jahren aktualisiert.

Status:
Gemeldet
Priorität:
Hoch
Zugewiesen an:
-
Kategorie:
Change
% erledigt:

0%

Betroffene Versionen:
Unbestimmt

Beschreibung

In the upcoming feature release GX v4.1 there will be an update of the Slim dependency from v2 to v4. This update brings breaking changes regarding the REST API v2.

The AbstractApiV2Controller class will from then on no longer contain an api attribute of type \Slim\Slim, but the two attributes request of type Slim\Http\ServerRequest and response of type Slim\Http\Response.
Overloads or controllers that used the api attribute must be modified accordingly.

The following code examples show how such a customization might look like.

Before:

        $this->api->response->setStatus(200);
        $this->api->response->headers->set('Content-Type', 'application/json; charset=utf-8');
        $this->api->response->headers->set('X-Shop-Version', $shopVersion);

After:

        $this->response = $this->response->withStatus(200);
        $this->response = $this->response->withHeader('Content-Type', 'application/json; charset=utf-8');
        $this->response = $this->response->withHeader('X-Shop-Version', $shopVersion);

Aktionen

Auch abrufbar als: Atom PDF