github :: HookAction
github :: HookAction :: _listener
Listener that contains this action.github :: HookAction :: defaultinit
github :: HookAction :: listener
Listener that contains this action.github :: HookAction :: listener=
Listener that contains this action.github $ HookAction :: SELF
Type of this instance, automatically specialized in every classgithub $ HookAction :: answer
Parse hook request then calllistener.apply_event
.
github :: HookAction :: _listener
Listener that contains this action.HttpResponse
destined to the client in response to the request
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitcorn :: Action :: defaultinit
core :: Object :: defaultinit
github :: HookAction :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
github :: HookAction :: listener
Listener that contains this action.github :: HookAction :: listener=
Listener that contains this action.core :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).nitcorn :: Action :: prepare_respond_and_close
Full to arequest
with sending the response and closing of the http_server
# A nitcorn action dedicated to GitHub hook listening.
private class HookAction
super Action
# Listener that contains this action.
#
# The `listener` is used for its `event_factory` method
# and the `apply_event`.
var listener: HookListener
# Parse hook request then call `listener.apply_event`.
redef fun answer(request, uri) do
# get event type
var kind = request.header.get_or_null("X-GitHub-Event")
if kind == null then return new HttpResponse(403)
# parse event
var event = listener.event_factory(kind, request.body)
if event == null then return new HttpResponse(403)
listener.apply_event(event)
return new HttpResponse(200)
end
end
lib/github/hooks.nit:126,1--147,3