Skip to content

Commit

Permalink
📝 Added Basic UntilHttp Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfred Neequaye committed Dec 2, 2022
1 parent 011ae92 commit bfa4e19
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/api/wait_strategies.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,30 @@ _ = new TestcontainersBuilder<TestcontainersContainer>()
.Build();
```

## Wait until Http Request is successful

You can wait for an HttpResponseCode or even compare the Response Body of an http request to an exposed port on your container

```csharp
_ = new TestcontainersBuilder<TestcontainersContainer>()
.WithWaitStrategy(
Wait.ForUnixContainer()
.UntilHttp() //Default to a GET to localhost:80 [ExposedfromContianer] Expecting 200 with no response body Validation
.Build();
```
or with Options
```csharp
_ = new TestcontainersBuilder<TestcontainersContainer>()
.WithWaitStrategy(
Wait.ForUnixContainer()
.UntilHttp( options => {
options.Port = [YourServiceExposedPort];
options.Path = [RequestPath];
options.Method = [HttpRequestMethod];
options.ExpectedResponseCodes = new(){ HttpStatusCode.OK, HttpStatusCode.Accepted };
})
.Build();
```

[docker-docs-healthcheck]: https://docs.docker.com/engine/reference/builder/#healthcheck
3 changes: 3 additions & 0 deletions src/Testcontainers/Configurations/UntilHttpOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ namespace DotNet.Testcontainers.Configurations
using System.Net.Http;
using System.Security;

/// <summary>
/// Configured the Request and Response Behaviour of the UntilHttp Wait
/// </summary>
public class UntilHttpOptions
{
public UntilHttpOptions()
Expand Down

0 comments on commit bfa4e19

Please sign in to comment.