-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
How can I retrieve options data from browser's OPTIONS request #2608
Comments
I’m not looking for actual data from the resource, the communication description is exactly what I’m looking for. I am using django-rest-framewrok and the OPTIONS result contains the description of what can be posted, the fields, description, field types, etc. I am using this to dynamically generate a form that is used to POST or PUT to the target in a restful way as described by the api. Right now, it works flawlessly, but there are two OPTIONS calls, the first one is the one I invoke myself because I did not figure out how I can retrieve the OPTIONS response from a simple GET request using axios. In other words, my OPTIONS usage is perfectly fine, I’m only wondering how I can retrieve the OPTIONS response automatically sent by the browser instead of manually invoking it. At this point in my case, it’s definitely an early optimization. It’s more a matter of knowing if it’s possible to do so. Thanks |
@GabLeRoux Sorry for misunderstanding your problem. But as far as I know, the preflight OPTIONS request is send by the browser automatically and we can't retrieve response from it. Maybe you can ask in stackoverflow. It is an interesting question and I am glad to follow your question if it is somewhere. |
Hope it can solve your double OPTIONS problem. |
Is there a way to retrieve browser's
OPTIONS
response data when doing aGET
request or do I absolutely need to callaxios.options()
on my own?I plan to generate a form based on the response data sent from an API's
OPTIONS
response I can then generate a form dynamically. Right now, when doingOPTIONS
request on my own, it works just fine, but when I do aGET
request, there's an additionalOPTIONS
request sent.Just asking, but it doesn't make a big difference in the end. I guess if I want to only have a single
OPTIONS
call, I'd have to follow #888The text was updated successfully, but these errors were encountered: