HTTP Endpoint
Configure URL, method, auth, body type, and tracking location for HTTP flows.
Produce and Consume
Use HTTP as source producer or destination consumer based on run mode. Produce and consume endpoint contracts both require an absolute URL.
Auth
Basic, Bearer, OAuth2 client credentials, and custom headers are supported. For Basic auth, username is required and password may be empty (null is rejected).
Advanced HTTP Fields
Use RequestTimeout to control request duration, TrackingPayloadSource to decide whether tracking extraction reads request or response payload, and ConsumeJsonArrayResponse when destination responses are JSON arrays of messages. RequestTimeout must be positive when explicitly configured.
OAuth2 Client Credentials Fields
OAuth2ClientCredentials supports TokenEndpoint, ClientId, ClientSecret, Scopes, and AdditionalFormFields for token endpoint-specific requirements.
Feature Usage Samples
How to use snippets for HTTP Endpoint.
Switch between C#, Java, Python, TypeScript, and JavaScript to see the native SDK shape for this sample.
Licensing note: every runnable sample requires a valid runner key via WithRunnerKey("...") or config key LoadStrike:RunnerKey.
HTTP Endpoint
var endpoint = new HttpEndpointDefinition
{
Name = "http-in",
Mode = TrafficEndpointMode.Produce,
TrackingField = TrackingFieldSelector.Parse("json:$.trackingId"),
Url = "https://api.example.com/orders",
Method = "POST",
BodyType = HttpRequestBodyType.Json,
RequestTimeout = TimeSpan.FromSeconds(15),
MessagePayload = new { trackingId = "trk-1" }
};
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
var client = HttpClient.newHttpClient();
var scenario = LoadStrikeScenario.create("http-check", context ->
LoadStrikeStep.run("GET /health", context, () -> {
var request = HttpRequest.newBuilder(URI.create("https://example.com/health")).GET().build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
return response.statusCode() < 400
? LoadStrikeResponse.ok(Integer.toString(response.statusCode()))
: LoadStrikeResponse.fail(Integer.toString(response.statusCode()));
}).asReply()
);
import urllib.request
from loadstrike_sdk import LoadStrikeResponse, LoadStrikeScenario, LoadStrikeStep
scenario = LoadStrikeScenario.create(
"http-check",
lambda context: LoadStrikeStep.run(
"GET /health",
context,
lambda: LoadStrikeResponse.ok(
str(urllib.request.urlopen("https://example.com/health").status)
),
)["as_reply"](),
)
const scenario = LoadStrikeScenario.create("http-check", async (context) => {
return LoadStrikeStep.run("GET /health", context, async () => {
const response = await fetch("https://example.com/health");
return response.ok
? LoadStrikeResponse.ok(String(response.status))
: LoadStrikeResponse.fail(String(response.status));
});
});
const scenario = LoadStrikeScenario.create("http-check", async (context) => {
return LoadStrikeStep.run("GET /health", context, async () => {
const response = await fetch("https://example.com/health");
return response.ok
? LoadStrikeResponse.ok(String(response.status))
: LoadStrikeResponse.fail(String(response.status));
});
});
Body Example
Sample body field that the tracking selector can read when the ID is carried in JSON instead of a header.
Optional HTTP timeout override; when set explicitly it must be a positive duration.
{ "trackingId": "trk-1" }