Sending custom headers on "raise Goliath::Validation::Error"

45 views
Skip to first unread message

Jean Collonvillé

unread,
Sep 26, 2013, 4:43:43 AM9/26/13
to golia...@googlegroups.com
Hi,
I'm writing an application that is doing authentication checks in the on_headers method. On authentication failure I'm raising a Goliath::Validation::Error but I'd like also my http client to receive some custom headers I need for some cross domain ajax.
How can I possibly achieve this ? All I need is to respond on the on_headers and cut off the connection before the client starts sending its body content.

Thanks a lot for any help.

Thiago Lewin

unread,
Sep 27, 2013, 12:59:56 PM9/27/13
to golia...@googlegroups.com
Hi,

  I don't know if there is a "standard way" to achieve it.
  One quick solution, you can wrap the post_process method from Request class, like this: https://gist.github.com/tlewin/6731617
  Be careful on this kind of solution, since you are intercepting the normal Goliath flow.

Regards,
Thiago

Jean Collonvillé

unread,
Sep 30, 2013, 3:39:17 AM9/30/13
to golia...@googlegroups.com
Thanks a lot. It works as espected :)
Reply all
Reply to author
Forward
0 new messages