Home > Mobile >  How to handle `OPTIONS` in Spock?
How to handle `OPTIONS` in Spock?

Time:05-29

I'm trying to init ajax request to backend which was built in spock

handling post and get request is quite easy, there are post and get from spock to handle these request.

when I'm trying to handle prefight request which inited by ajax library. it requires OPTIONS verb, I failed to find one to handle that .

Pls kindly advise how to solve this issue ( handling OPTIONS verb in spock) ? Thanks !

CodePudding user response:

Looking at the source of that module, get is defined as just hookRoute GET, and post is defined as just hookRoute POST, so just call hookRoute OPTIONS with the path and action you want to match.

  • Related