Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Context Helpers #8

Open
SampaioLeal opened this issue Oct 17, 2021 · 1 comment
Open

Context Helpers #8

SampaioLeal opened this issue Oct 17, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@SampaioLeal
Copy link
Owner

SampaioLeal commented Oct 17, 2021

The framework has to give developer helper functions to manage request context.

Some ideas:

  • A function to set response status
  • A decorator to set success HttpCode - by @yan-almeida

Well, writing this i realized that oak has a good structure and properties in context...
The issue will be open until we get some other ideas

@SampaioLeal SampaioLeal added the enhancement New feature or request label Oct 17, 2021
@yan-almeida
Copy link

yan-almeida commented Oct 17, 2021

A good practice would be to adopt a decorator to configure the HTTP response.

Something like:

// where the StatusCode receives an enum of http-status
@HttpCode(StatusCode);

Use case:

// overrinding request status
@HttpCode(StatusCode.CREATED);
created (... args) {
  return 'Creating something.'
}

We should return 201 - Created when we get a successful response while creating some resource.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants