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

Fix executeActionsEmail via explicit ContentType declaration #142

Merged
merged 4 commits into from
Jan 23, 2025

Conversation

danielmaier42
Copy link

Unfortunately the executeActionsEmail endpoint is not working right now as it does not comply with the Keycloak Api. This is because of the behaviour of the CommandExecutor which would use the application/x-www-form-urlencoded ContentType whenever only an array is defined as Payload. For the executeActionsEmail endpoint only an Array of Actions is required but Keycloak expects an application/json Content-Type. Therefore i added the (fully optional) possibility to specify the ContentType explicitly when creating the Command. By now i only updated the one Command with which i had issues - maybe this issues applies to some other endpoints as well.

Copy link

codecov bot commented Jan 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.26%. Comparing base (ab02f04) to head (f8cd4fe).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #142      +/-   ##
==========================================
- Coverage   99.26%   99.26%   -0.01%     
==========================================
  Files          27       27              
  Lines         820      816       -4     
==========================================
- Hits          814      810       -4     
  Misses          6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fschmtt
Copy link
Owner

fschmtt commented Jan 17, 2025

I think I broke this with this change: https://github.com/fschmtt/keycloak-rest-api-client-php/pull/136/files#diff-89227d64a8c020db74ce710e36b3a1b780a01fce857a4bbf524f58c8ef1014beR25-R35

I thought that we can safely use the application/x-www-form-urlencoded content type if the payload is an array - but obviously not 🙈

I'd keep your change to provide the ContentType to the Command but change its default value to JSON (i.e. not allow null) because it's used for the majority of commands.

@fschmtt
Copy link
Owner

fschmtt commented Jan 17, 2025

Do you mind if I take your PR and make some adjustments to your changes?

@danielmaier42
Copy link
Author

Do you mind if I take your PR and make some adjustments to your changes?

Feel free to do so :)

@fschmtt
Copy link
Owner

fschmtt commented Jan 20, 2025

I couldn't help myself and already did, would be great if you could help me out here: #143 (comment) 🙂

@fschmtt fschmtt merged commit b13ebf5 into fschmtt:main Jan 23, 2025
13 checks passed
@fschmtt
Copy link
Owner

fschmtt commented Jan 23, 2025

Hey man, I merged your PR, thanks for contributing! 🎉

I'll release a new version in a minute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants