Class Endpoint
- Namespace
- CSF.Screenplay.WebApis
- Assembly
- CSF.Screenplay.WebApis.dll
A Web API endpoint which has no expected request payload and which is not expected to return a response body.
public class Endpoint : EndpointBase, IHasName
- Inheritance
-
Endpoint
- Implements
- Inherited Members
Remarks
There are several concrete types of endpoint available, all of which derive from EndpointBase, for more information about the purpose of endpoints and how they are used, see the documentation for that base type.
Developers are welcome to create specialized derived types based upon this or other subclasses of EndpointBase if they have specific needs. Derived classes should overrideGetHttpRequestMessageBuilder() with a method that calls the base implementation and then further manipulates the message builder before returning it.
When using or deriving from this class, developers are strongly encouraged to set the Name property to a human-readable name for this endpoint. This will improve the readability of reports.
For more information, see the documentation article for using web APIs.
Constructors
Endpoint(string, HttpMethod)
Initializes a new instance of Endpoint with a relative URI and an optional HTTP method.
public Endpoint(string relativeUri, HttpMethod method = null)
Parameters
relativeUri
stringA relative URI string for the current endpoint.
method
HttpMethodAn optional HTTP method.
Remarks
When setting the relative URI, avoid a leading forward-slash. Prefer myApp/doSomething
over /myApp/doSomething
.
If you omit the HTTP method, then the created builder will also not specify an HTTP method, which
(if used to generate a request) will result in an HTTP GET
request. See CreateRequestMessage().
Endpoint(Uri, HttpMethod)
Initializes a new instance of Endpoint with a URI and an optional HTTP method.
public Endpoint(Uri uri, HttpMethod method = null)
Parameters
uri
UriA URI for the current endpoint; this may be relative or absolute.
method
HttpMethodAn optional HTTP method.
Remarks
If you omit the HTTP method, then the created builder will also not specify an HTTP method, which
(if used to generate a request) will result in an HTTP GET
request. See CreateRequestMessage().
Methods
GetHttpRequestMessageBuilder()
Gets a HttpRequestMessageBuilder from the state of the current instance.
public virtual HttpRequestMessageBuilder GetHttpRequestMessageBuilder()
Returns
- HttpRequestMessageBuilder
An HTTP request message builder