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

Return empty Record<string, unknown> for default context function #413

Open
sgohlke opened this issue Nov 28, 2024 · 0 comments
Open

Return empty Record<string, unknown> for default context function #413

sgohlke opened this issue Nov 28, 2024 · 0 comments
Labels
v5 issues for v5.x release

Comments

@sgohlke
Copy link
Collaborator

sgohlke commented Nov 28, 2024

At the moment (version 4.x) we return the request object in the defaultContextFunction. This may cause issues like in https://github.com/dreamit-de/uexpress-example/actions/runs/12001332310/job/33451686378 where a readonly field query exists and setting it causes an unhandledRejection.

# Error: A resource generated asynchronous activity after the test ended. 
This activity created the error "TypeError: 
Cannot set property query of \#<Request> which has only a getter" which
triggered an unhandledRejection event, caught by the test runner.

I think the context should have the type Record<string, unknown> and the defaultContextFunction should return an empty Record so additional information can be properly added without manipulating the original request object.

This introduces a change in the default behaviour and thus a breaking change.

@sgohlke sgohlke added the v5 issues for v5.x release label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v5 issues for v5.x release
Projects
None yet
Development

No branches or pull requests

1 participant