mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
* make FakeRequest compatible with http request * FakeRequest compatible with Http Request
This commit is contained in:
parent
d70349e642
commit
cfad1013db
6 changed files with 8 additions and 8 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
## ElasticsearchErrorHelpers class
|
||||
|
||||
Helpers provided to simplify future migration away from Boom as internal Error.
|
||||
Helpers for working with errors returned from the Elasticsearch service.Since the internal data of errors are subject to change, consumers of the Elasticsearch service should always use these helpers to classify errors instead of checking error internals such as `body.error.header[WWW-Authenticate]`
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
|
@ -25,7 +25,7 @@ Handle errors
|
|||
|
||||
```js
|
||||
try {
|
||||
await client.callWithRequest(request, '...');
|
||||
await client.asScoped(request).callAsCurrentUser(...);
|
||||
} catch (err) {
|
||||
if (ElasticsearchErrorHelpers.isNotAuthorizedError(err)) {
|
||||
const authHeader = err.output.headers['WWW-Authenticate'];
|
||||
|
|
|
@ -9,5 +9,5 @@ Headers used for authentication against Elasticsearch
|
|||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
headers: Record<string, string>;
|
||||
headers: Headers;
|
||||
```
|
||||
|
|
|
@ -16,5 +16,5 @@ export interface FakeRequest
|
|||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [headers](./kibana-plugin-server.fakerequest.headers.md) | <code>Record<string, string></code> | Headers used for authentication against Elasticsearch |
|
||||
| [headers](./kibana-plugin-server.fakerequest.headers.md) | <code>Headers</code> | Headers used for authentication against Elasticsearch |
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
|||
| Class | Description |
|
||||
| --- | --- |
|
||||
| [ClusterClient](./kibana-plugin-server.clusterclient.md) | Represents an Elasticsearch cluster API client and allows to call API on behalf of the internal Kibana user and the actual user that is derived from the request headers (via <code>asScoped(...)</code>). |
|
||||
| [ElasticsearchErrorHelpers](./kibana-plugin-server.elasticsearcherrorhelpers.md) | Helpers provided to simplify future migration away from Boom as internal Error. |
|
||||
| [ElasticsearchErrorHelpers](./kibana-plugin-server.elasticsearcherrorhelpers.md) | Helpers for working with errors returned from the Elasticsearch service.Since the internal data of errors are subject to change, consumers of the Elasticsearch service should always use these helpers to classify errors instead of checking error internals such as <code>body.error.header[WWW-Authenticate]</code> |
|
||||
| [KibanaRequest](./kibana-plugin-server.kibanarequest.md) | Kibana specific abstraction for an incoming request. |
|
||||
| [Router](./kibana-plugin-server.router.md) | |
|
||||
| [SavedObjectsErrorHelpers](./kibana-plugin-server.savedobjectserrorhelpers.md) | |
|
||||
|
|
|
@ -22,7 +22,7 @@ import { Request } from 'hapi';
|
|||
|
||||
import { ElasticsearchErrorHelpers } from './errors';
|
||||
import { GetAuthHeaders, isRealRequest } from '../http';
|
||||
import { filterHeaders, KibanaRequest, ensureRawRequest } from '../http/router';
|
||||
import { filterHeaders, Headers, KibanaRequest, ensureRawRequest } from '../http/router';
|
||||
import { Logger } from '../logging';
|
||||
import {
|
||||
ElasticsearchClientConfig,
|
||||
|
@ -106,7 +106,7 @@ async function callAPI(
|
|||
*/
|
||||
export interface FakeRequest {
|
||||
/** Headers used for authentication against Elasticsearch */
|
||||
headers: Record<string, string>;
|
||||
headers: Headers;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -154,7 +154,7 @@ export interface ElasticsearchServiceSetup {
|
|||
|
||||
// @public
|
||||
export interface FakeRequest {
|
||||
headers: Record<string, string>;
|
||||
headers: Headers;
|
||||
}
|
||||
|
||||
// @public
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue