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

feat: Use Backend for Recipe Post Actions #4163

Conversation

michael-genson
Copy link
Collaborator

What type of PR is this?

(REQUIRED)

  • bug
  • feature

What this PR does / why we need it:

(REQUIRED)

This leverages the backend to make POST requests for recipe actions. The previous implementation had issues requiring us to send the content type text/plain. Using the backend we get around this. Consequently, it's also a lot faster for the user since we don't have to wait for the response from the external server (the backend uses background tasks from FastAPI so it can return a 202 response immediately).

Since we now send the correct content header (application/json) it should work nicely with Home Assistant. Since this feature was already slightly broken because of the content header, I took this time to improve the actual payload to include the recipe action. This results in a breaking change, though a minor one (since it was impossible to extract the body previously anyway in a lot of applications). We also don't use merge fields in the POST type, since we're already sending all the data in the payload anyway.

Which issue(s) this PR fixes:

(REQUIRED)

Fixes #3936

Testing

(fill-in or delete this section)

Pytest backend, manual frontend

Copy link
Collaborator

@boc-the-git boc-the-git left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

@michael-genson michael-genson enabled auto-merge (squash) September 14, 2024 14:51
@michael-genson michael-genson merged commit d8dbcac into mealie-recipes:mealie-next Sep 14, 2024
13 checks passed
@michael-genson michael-genson deleted the feat/use-backend-for-recipe-post-actions branch September 14, 2024 18:49
boc-the-git pushed a commit to boc-the-git/mealie that referenced this pull request Sep 28, 2024
boc-the-git pushed a commit to boc-the-git/mealie that referenced this pull request Sep 28, 2024
Choromanski pushed a commit to Choromanski/mealie that referenced this pull request Oct 1, 2024
@Kuchenpirat Kuchenpirat added the v2 Version 2 Issue/PR label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] - Recipe Actions don't work with Home Assistant due to incorrect content type header
3 participants