Skip to content

Commit

Permalink
update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
mshustov authored and joshdover committed Aug 19, 2019
1 parent f04d9cf commit 379e6f4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/core/server/http/http_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ import { BasePath } from './base_path_service';
* And `response` object instructing HTTP server to create HTTP response with information sent back to the client as the response body, headers, and HTTP status.
* Unlike, `hapi` route handler in the Legacy platform, any exception raised during the handler call will generate `500 Server error` response and log error details for further investigation. See below for returning custom error responses.
* ```ts
* const handler = async (request: KibanaRequest, response: ResponseFactory) => {
* const handler = async (context: RequestHandlerContext, request: KibanaRequest, response: ResponseFactory) => {
* const data = await findObject(request.params.id);
* // creates a command to respond with 'not found' error
* if (!data) return response.notFound();
* // creates a command to send found data to the client and set response headers
* return response.ok(data, {
* return response.ok({
* body: data,
* headers: {
* 'content-type': 'application/json'
* }
Expand All @@ -97,7 +98,8 @@ import { BasePath } from './base_path_service';
* async (context, request, response) => {
* const data = await findObject(request.params.id);
* if (!data) return response.notFound();
* return response.ok(data, {
* return response.ok({
* body: data,
* headers: {
* 'content-type': 'application/json'
* }
Expand Down

0 comments on commit 379e6f4

Please sign in to comment.