Преглед изворни кода

add generic 200 ok handler

George Baugh пре 5 месеци
родитељ
комит
73932a5d1a
1 измењених фајлова са 13 додато и 0 уклоњено
  1. 13 0
      lib/TPSGI.pm

+ 13 - 0
lib/TPSGI.pm

@@ -487,6 +487,19 @@ sub see_also {
     return [ 303, [ "Location" => $to, "Content-Length" => 0 ], [''] ];
 }
 
+=head2 ok
+
+Return a generic HTTP 200 OK
+
+=cut
+
+sub ok {
+    my ( $self, $query, $body ) = @_;
+    $self->INFO("$query->{method} 200 $query->{fullpath}");
+    $body //= 'Ok';
+    return _generic( $body, 200 );
+}
+
 =head2 notfound, forbidden, badrequest, toolong, error
 
 If you need to return these HTTP errors, return these within a route: