Http server route handler implementation#41894
Merged
mshustov merged 17 commits intoelastic:masterfrom Jul 31, 2019
Merged
Conversation
Contributor
|
Pinging @elastic/kibana-platform |
Contributor
💔 Build Failed |
Contributor
Author
|
retest |
Contributor
💔 Build Failed |
Contributor
💚 Build Succeeded |
mshustov
commented
Jul 25, 2019
mshustov
commented
Jul 25, 2019
mshustov
commented
Jul 25, 2019
mshustov
commented
Jul 25, 2019
| .expect(200); | ||
|
|
||
| expect(result.text).toBe('abc'); | ||
| expect(result.header['transfer-encoding']).toBe('chunked'); |
Contributor
Author
There was a problem hiding this comment.
note: some headers are set by hapi
Contributor
💔 Build Failed |
Contributor
💔 Build Failed |
mshustov
commented
Jul 25, 2019
Contributor
💚 Build Succeeded |
rudolf
reviewed
Jul 29, 2019
Contributor
Author
|
@joshdover @rudolf updated |
Contributor
💚 Build Succeeded |
rudolf
approved these changes
Jul 30, 2019
Closed
joshdover
approved these changes
Jul 30, 2019
mshustov
added a commit
to mshustov/kibana
that referenced
this pull request
Jul 31, 2019
* add response error * add hapi response adapter * add router handler * add tests * add comments, update docs * update tests * cleanup tests * address @joshdover comments * move tests under integration test cathegory * update docs * get rid of KibanResponseError class * update docs
mshustov
added a commit
that referenced
this pull request
Jul 31, 2019
* add response error * add hapi response adapter * add router handler * add tests * add comments, update docs * update tests * cleanup tests * address @joshdover comments * move tests under integration test cathegory * update docs * get rid of KibanResponseError class * update docs
jloleysens
added a commit
to jloleysens/kibana
that referenced
this pull request
Jul 31, 2019
…-or-edit-existing-rollup-job * 'master' of github.com:elastic/kibana: (114 commits) [ML] Fixing empty index pattern list (elastic#42299) [Markdown] Shim new platform - cleanup plugin (elastic#41760) [Code] Enable hierarchicalDocumentSymbolSupport for java language server (elastic#42233) Add New Platform mocks for data plugin (elastic#42261) Http server route handler implementation (elastic#41894) [SR] Allow custom index pattern to be used instead of selectable list when choosing indices to restore (elastic#41534) [Code] distributed Code abstraction (elastic#41374) [SIEM] Sets page titles to the current page you are on (elastic#42157) Saved Objects export API stable type order (elastic#42310) cancellation of interpreter execution (elastic#40238) [SIEM] Fixes a crash when Machine Learning influencers is an undefined value (elastic#42198) Changed the job to work with a dedicated index (elastic#42297) FTR: fix testSubjects.missingOrFail (elastic#42290) Increase retry timeout to prevent flaky tests (elastic#42291) Spaces - make space a hidden saved object type (elastic#41688) Allow applications to register feature privileges which are excluded from the base privileges (elastic#41300) Disable flaky log column reorder test (elastic#42285) Fixing add element in element reducer (elastic#42276) Fix infinite loop (elastic#42228) [Maps][File upload] Remove geojson deep clone logic, handle on maps side (elastic#41835) ...
This was referenced Aug 14, 2019
Contributor
💚 Build Succeeded |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
initial implementation of #39767
closes #33779
Extends
ResponseFactoryfunctionality to configure response payload, status and headers.Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.[ ] This was checked for cross-browser compatibility, including a check against IE11[ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support[ ] Documentation was added for features that require explanation or tutorials[ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers
Dev docs
Kibana HTTP Service in the New platform provides own abstraction for work with HTTP stack.
Plugins don't have direct access to
hapiserver and its primitives anymore. Moreover,plugins shouldn't rely on the fact that HTTP Service uses one or another library under the hood.
This gives the platform flexibility to upgrade or changing our internal HTTP stack without breaking plugins.
If the HTTP Service lacks functionality you need, we are happy to discuss and support your needs.
To handle an incoming request in your plugin you should:
Routerinstance. Router is already configured to useplugin-idto prefix path segment for your routes.@kbn/config-schemapackage to create a schema to validate the requestparams,query, andbody. Every incoming request will be validated against the created schema. If validation failed, the request is rejected with400status andBad requesterror without calling the route's handler.To opt out of validating the request, specify
false.The function will receive:
1.
contextruntime context providing access to Kibana API, specific for a route handler.2.
requestobject containing request details: url, headers, matched route, as well as validatedparams,query,body.3.
responseobject instructing HTTP server to create HTTP response with information sent back to the client as the response body, headers, and HTTP status.Unlike,
hapiroute handler in the Legacy platform, any exception raised during the handler call will generate500 Server errorresponse and log error details for further investigation. See below for returning custom error responses.