Raja,

request_method supports OPTIONS just as well as any of the ones you have 
listed. request_method takes a tuple that can contain any valid HTTP method 
(and invalid ones too, it doesn’t actually check them for validity).

The predicate is right here:

https://github.com/Pylons/pyramid/blob/2478de31b2e6d8d7667b9dd0c81f571130f3daf6/pyramid/config/predicates.py#L33-47

Notice line 47, it does a check to see if the request.method is in the tuple or 
not.

Cheers,
Bert

> On Dec 13, 2014, at 11:34, Raja Naresh <[email protected]> wrote:
> 
> Hello,
> 
> Is there a way to handle OPTIONS request in pyramid? The decorator 
> view_config's request_method parameter only accepts GET, PUT, POST, DELETE 
> and HEAD. The reason I ask is my client code has a XHR request in another 
> domain with a custom header, in which case according to the CORS policy it's 
> preflighted (which means it will make a HTTP OPTIONS request to check the 
> allowed methods and exposed headers). Is there anyway I can handle OPTIONS 
> requests in my pyramid backend? May be I am understanding this all wrong, any 
> kind of help is appreciated. Thank you. 
> 
> Regards,
> Raja
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/pylons-discuss.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to