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

ArgumentError: bad argument (expected URI object or URI string) when calling DELETE #514

Closed
cjhutchi opened this issue Oct 22, 2024 · 1 comment · Fixed by #515
Closed

Comments

@cjhutchi
Copy link

Didn't see this documented anywhere, and just wanted to raise this for visibility in case anyone is upgrading from 0.9.x to 0.10.x and is running into this error.

There was some logic added to the destroy method in the 0.10.0 release that uses the referrer on the request to add a turbo stream response when a resource is deleted. If you don't include a referrer on the request, you'll get the ArgumentError: bad argument (expected URI object or URI string) error because it will try to make a URI object out of nil.

If you have any calls to delete on a resource (I experienced it in a unit test), you now need to include a referrer in the headers of that call, e.g.:

delete Post.instance_path(post),
            headers: {
              HTTP_REFERER: Article.instance_path(article)
            }
@spohlenz
Copy link
Member

Thank you for reporting this. This should now be fixed in #515.

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 a pull request may close this issue.

2 participants