Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create JsonResponse #19

Merged
merged 3 commits into from
Apr 22, 2023
Merged

Create JsonResponse #19

merged 3 commits into from
Apr 22, 2023

Conversation

Chemaclass
Copy link
Member

@Chemaclass Chemaclass commented Apr 21, 2023

📚 Description

The main motivation is to get rid of this json header from the client side:
https://github.com/gacela-project/api-skeleton/blob/main/public/index.php#L18

Screenshot 2023-04-21 at 23 41 59

🔖 Changes

  • Create Response class
  • Create JsonResponse class (which extends Response)

The aim is to be able to use JsonResponse which receives an array,
and it converts it to a json and adds the proper json header. Eg:

Screenshot 2023-04-21 at 23 30 15

🤔 Follow up

How can we get rid of the other custom headers?
Eg: in the first screenshot, line 17: header('Access-Control-Allow-Origin: *');

@Chemaclass Chemaclass added the enhancement New feature or request label Apr 21, 2023
@Chemaclass Chemaclass self-assigned this Apr 21, 2023
@Chemaclass Chemaclass force-pushed the create-json-response branch from 30297c9 to beb787c Compare April 21, 2023 21:15
@Chemaclass Chemaclass force-pushed the create-json-response branch from 7ca3183 to aeea2ef Compare April 21, 2023 21:24
@Chemaclass Chemaclass marked this pull request as ready for review April 21, 2023 21:31
@Chemaclass Chemaclass merged commit 2aad05c into main Apr 22, 2023
@Chemaclass Chemaclass deleted the create-json-response branch April 22, 2023 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants