enonic / xp

Enonic XP
https://enonic.com
GNU General Public License v3.0
202 stars 34 forks source link

TS Add Request and Response to lib-portal #9742

Open edloidas opened 2 years ago

edloidas commented 2 years ago

Add Request and Response types under the lib-portal types.

ComLock commented 1 year ago

It would be nice if Request headers keys are stricter than string so code will be future proof for HTTP/2.

8.1.2.6. Malformed Requests and Responses

A malformed request or response is one that is an otherwise valid sequence of HTTP/2 frames but is invalid due to the presence of extraneous frames, prohibited header fields, the absence of mandatory header fields, or the inclusion of uppercase header field names.

ComLock commented 1 year ago

https://github.com/enonic/lib-react4xp/blob/master/src/main/resources/types/Request.d.ts https://github.com/enonic/lib-react4xp/blob/master/src/main/resources/types/Response.d.ts

ComLock commented 1 year ago

https://github.com/enonic/enonic-js-utils/blob/main/types/Request.d.ts

ComLock commented 1 year ago

I wonder how many times I've done this :) https://github.com/enonic/app-explorer/blob/master/src/main/resources/types/Request.d.ts

ComLock commented 1 year ago

Many :) https://github.com/enonic/lib-explorer/blob/master/src/main/resources/lib/explorer/types/Request.d.ts https://github.com/enonic/lib-explorer/blob/master/src/main/resources/lib/explorer/types/Response.d.ts

ComLock commented 1 year ago

I keep forgetting there is no such thing as lowercasestring in typings yet.

ComLock commented 1 year ago

Lowercase<StringType> https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#lowercasestringtype

ComLock commented 6 hours ago

Here we go again :) https://github.com/enonic/lib-static/blob/master/src/main/resources/lib/enonic/static/types/Request.d.ts https://github.com/enonic/lib-static/blob/master/src/main/resources/lib/enonic/static/types/Response.d.ts