docs(api): expose request API in java (#10331)

This commit is contained in:
Yury Semikhatsky 2021-11-15 14:54:07 -08:00 committed by GitHub
parent c5cb73003f
commit 565ac910e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 43 additions and 13 deletions

View file

@ -1,10 +1,10 @@
# class: APIRequest
* langs: js, python
* langs: js, java, python
Exposes API that can be used for the Web API testing.
## async method: APIRequest.newContext
* langs: js, python
* langs: js, java, python
- returns: <[APIRequestContext]>
Creates new instances of [APIRequestContext].
@ -30,6 +30,7 @@ Methods like [`method: APIRequestContext.get`] take the base URL into considerat
* baseURL: `http://localhost:3000/foo/` and sending request to `./bar.html` results in `http://localhost:3000/foo/bar.html`
### option: APIRequest.newContext.storageState
* langs: js, python
- `storageState` <[path]|[Object]>
- `cookies` <[Array]<[Object]>>
- `name` <[string]>
@ -51,3 +52,13 @@ obtained via [`method: BrowserContext.storageState`] or [`method: APIRequestCont
file with saved storage, or the value returned by one of [`method: BrowserContext.storageState`] or
[`method: APIRequestContext.storageState`] methods.
### option: APIRequest.newContext.storageState
* langs: java
- `storageState` <[string]>
Populates context with given storage state. This option can be used to initialize context with logged-in information
obtained via [`method: BrowserContext.storageState`] or [`method: APIRequestContext.storageState`]. Either a path to the
file with saved storage, or the value returned by one of [`method: BrowserContext.storageState`] or
[`method: APIRequestContext.storageState`] methods.
### option: APIRequest.newContext.storageStatePath = %%-csharp-java-context-option-storage-state-path-%%

View file

@ -1,5 +1,5 @@
# class: APIRequestContext
* langs: js, python
* langs: js, java, python
This API is used for the Web API testing. You can use it to trigger API endpoints, configure micro-services, prepare
environment or the service to your e2e test. When used on [Page] or a [BrowserContext], this API will automatically use
@ -18,7 +18,8 @@ context cookies from the response. The method will automatically follow redirect
### option: APIRequestContext.delete.headers = %%-fetch-option-headers-%%
### option: APIRequestContext.delete.data = %%-fetch-option-data-%%
### option: APIRequestContext.delete.form = %%-fetch-option-form-%%
### option: APIRequestContext.delete.multipart = %%-fetch-option-multipart-%%
### option: APIRequestContext.delete.multipart = %%-js-pyhton-fetch-option-multipart-%%
### option: APIRequestContext.delete.multipart = %%-java-fetch-option-multipart-%%
### option: APIRequestContext.delete.timeout = %%-fetch-option-timeout-%%
### option: APIRequestContext.delete.failOnStatusCode = %%-fetch-option-failonstatuscode-%%
### option: APIRequestContext.delete.ignoreHTTPSErrors = %%-context-option-ignorehttpserrors-%%
@ -50,7 +51,8 @@ If set changes the fetch method (e.g. [PUT](https://developer.mozilla.org/en-US/
### option: APIRequestContext.fetch.headers = %%-fetch-option-headers-%%
### option: APIRequestContext.fetch.data = %%-fetch-option-data-%%
### option: APIRequestContext.fetch.form = %%-fetch-option-form-%%
### option: APIRequestContext.fetch.multipart = %%-fetch-option-multipart-%%
### option: APIRequestContext.fetch.multipart = %%-js-pyhton-fetch-option-multipart-%%
### option: APIRequestContext.fetch.multipart = %%-java-fetch-option-multipart-%%
### option: APIRequestContext.fetch.timeout = %%-fetch-option-timeout-%%
### option: APIRequestContext.fetch.failOnStatusCode = %%-fetch-option-failonstatuscode-%%
### option: APIRequestContext.fetch.ignoreHTTPSErrors = %%-context-option-ignorehttpserrors-%%
@ -95,7 +97,8 @@ context cookies from the response. The method will automatically follow redirect
### option: APIRequestContext.patch.headers = %%-fetch-option-headers-%%
### option: APIRequestContext.patch.data = %%-fetch-option-data-%%
### option: APIRequestContext.patch.form = %%-fetch-option-form-%%
### option: APIRequestContext.patch.multipart = %%-fetch-option-multipart-%%
### option: APIRequestContext.patch.multipart = %%-js-pyhton-fetch-option-multipart-%%
### option: APIRequestContext.patch.multipart = %%-java-fetch-option-multipart-%%
### option: APIRequestContext.patch.timeout = %%-fetch-option-timeout-%%
### option: APIRequestContext.patch.failOnStatusCode = %%-fetch-option-failonstatuscode-%%
### option: APIRequestContext.patch.ignoreHTTPSErrors = %%-context-option-ignorehttpserrors-%%
@ -112,7 +115,8 @@ context cookies from the response. The method will automatically follow redirect
### option: APIRequestContext.post.headers = %%-fetch-option-headers-%%
### option: APIRequestContext.post.data = %%-fetch-option-data-%%
### option: APIRequestContext.post.form = %%-fetch-option-form-%%
### option: APIRequestContext.post.multipart = %%-fetch-option-multipart-%%
### option: APIRequestContext.post.multipart = %%-js-pyhton-fetch-option-multipart-%%
### option: APIRequestContext.post.multipart = %%-java-fetch-option-multipart-%%
### option: APIRequestContext.post.timeout = %%-fetch-option-timeout-%%
### option: APIRequestContext.post.failOnStatusCode = %%-fetch-option-failonstatuscode-%%
### option: APIRequestContext.post.ignoreHTTPSErrors = %%-context-option-ignorehttpserrors-%%
@ -129,7 +133,8 @@ context cookies from the response. The method will automatically follow redirect
### option: APIRequestContext.put.headers = %%-fetch-option-headers-%%
### option: APIRequestContext.put.data = %%-fetch-option-data-%%
### option: APIRequestContext.put.form = %%-fetch-option-form-%%
### option: APIRequestContext.put.multipart = %%-fetch-option-multipart-%%
### option: APIRequestContext.put.multipart = %%-js-pyhton-fetch-option-multipart-%%
### option: APIRequestContext.put.multipart = %%-java-fetch-option-multipart-%%
### option: APIRequestContext.put.timeout = %%-fetch-option-timeout-%%
### option: APIRequestContext.put.failOnStatusCode = %%-fetch-option-failonstatuscode-%%
### option: APIRequestContext.put.ignoreHTTPSErrors = %%-context-option-ignorehttpserrors-%%
@ -153,4 +158,8 @@ context cookies from the response. The method will automatically follow redirect
Returns storage state for this request context, contains current cookies and local storage snapshot if it was passed to the constructor.
## async method: APIRequestContext.storageState
* langs: java
- returns: <[string]>
### option: APIRequestContext.storageState.path = %%-storagestate-option-path-%%

View file

@ -1,5 +1,5 @@
# class: APIResponse
* langs: js, python
* langs: js, java, python
[APIResponse] class represents responses returned by [`method: APIRequestContext.get`] and similar methods.

View file

@ -850,7 +850,7 @@ Creates a new page in the browser context.
Returns all open pages in the context.
## property: BrowserContext.request
* langs: js, python
* langs: js, java, python
- type: <[APIRequestContext]>
API testing helper associated with this context. Requests made with this API will use context cookies.

View file

@ -2473,7 +2473,7 @@ last redirect.
### option: Page.reload.timeout = %%-navigation-timeout-%%
## property: Page.request
* langs: js
* langs: js, java, python
- type: <[APIRequestContext]>
API testing helper associated with this page. Requests made with this API will use page cookies.

View file

@ -215,7 +215,7 @@ except TimeoutError as e:
This object can be used to launch or connect to Firefox, returning instances of [Browser].
## property: Playwright.request
* langs: js, python
* langs: js, java, python
- type: <[APIRequest]>
Exposes API that can be used for the Web API testing.

View file

@ -331,7 +331,8 @@ Provides an object that will be serialized as html form using `application/x-www
this request body. If this parameter is specified `content-type` header will be set to `application/x-www-form-urlencoded`
unless explicitly provided.
## fetch-option-multipart
## js-pyhton-fetch-option-multipart
* langs: js, python
- `multipart` <[Object]<[string], [string]|[float]|[boolean]|[ReadStream]|[Object]>>
- `name` <[string]> File name
- `mimeType` <[string]> File type
@ -342,6 +343,15 @@ this request body. If this parameter is specified `content-type` header will be
unless explicitly provided. File values can be passed either as [`fs.ReadStream`](https://nodejs.org/api/fs.html#fs_class_fs_readstream)
or as file-like object containing file name, mime-type and its content.
## java-fetch-option-multipart
* langs: java
- `multipart` <[Object]<[string], [any]>>
Provides an object that will be serialized as html form using `multipart/form-data` encoding and sent as
this request body. If this parameter is specified `content-type` header will be set to `multipart/form-data`
unless explicitly provided. File values can be passed either as [File] or as file-like object [FilePayload]
containing file name, mime-type and its content.
## fetch-option-data
- `data` <[string]|[Buffer]|[Serializable]>