Documentation
¶
Index ¶
- func ExtractHrespDefines(hrespContent string) (map[string]string, string, error)
- func Ptr[T any](v T) *T
- func RunClientExecuteFileWithEncoding(t *testing.T)
- func RunCookieJarHandling(t *testing.T)
- func RunCreateTestFileFromTemplate_DebugOutput(t *testing.T)
- func RunExecuteFile_CapturesResponseHeaders(t *testing.T)
- func RunExecuteFile_ExternalFileNotFound(t *testing.T)
- func RunExecuteFile_ExternalFileWithEncoding(t *testing.T)
- func RunExecuteFile_ExternalFileWithVariables(t *testing.T)
- func RunExecuteFile_ExternalFileWithVariablesAndEncoding(t *testing.T)
- func RunExecuteFile_ExternalFileWithoutVariables(t *testing.T)
- func RunExecuteFile_GraphQLBasicQuery(t *testing.T)
- func RunExecuteFile_GraphQLBatchQueries(t *testing.T)
- func RunExecuteFile_GraphQLErrorHandling(t *testing.T)
- func RunExecuteFile_GraphQLFragments(t *testing.T)
- func RunExecuteFile_GraphQLIntrospection(t *testing.T)
- func RunExecuteFile_GraphQLMutation(t *testing.T)
- func RunExecuteFile_GraphQLQueryWithVariables(t *testing.T)
- func RunExecuteFile_IgnoreEmptyBlocks_Client(t *testing.T)
- func RunExecuteFile_InPlace_Malformed_NameOnlyNoEqualsNoValue(t *testing.T)
- func RunExecuteFile_InPlace_Malformed_NoNameEqualsValue(t *testing.T)
- func RunExecuteFile_InPlace_SimpleVariableInURL(t *testing.T)
- func RunExecuteFile_InPlace_VariableDefinedByAnotherInPlaceVariable(t *testing.T)
- func RunExecuteFile_InPlace_VariableDefinedByAnotherVariable(t *testing.T)
- func RunExecuteFile_InPlace_VariableDefinedByDotEnvOsVariable(t *testing.T)
- func RunExecuteFile_InPlace_VariableDefinedByDotEnvSystemVariable(t *testing.T)
- func RunExecuteFile_InPlace_VariableDefinedByOsEnvVariable(t *testing.T)
- func RunExecuteFile_InPlace_VariableDefinedByRandomInt(t *testing.T)
- func RunExecuteFile_InPlace_VariableDefinedBySystemVariable(t *testing.T)
- func RunExecuteFile_InPlace_VariableInAuthHeader(t *testing.T)
- func RunExecuteFile_InPlace_VariableInBody(t *testing.T)
- func RunExecuteFile_InPlace_VariableInCustomHeader(t *testing.T)
- func RunExecuteFile_InPlace_VariableInHeader(t *testing.T)
- func RunExecuteFile_InPlace_VariableInJsonRequestBody(t *testing.T)
- func RunExecuteFile_InPlace_VariablePrecedenceOverEnvironment(t *testing.T)
- func RunExecuteFile_InPlace_VariableSubstitutionInBody(t *testing.T)
- func RunExecuteFile_InvalidMethodInFile(t *testing.T)
- func RunExecuteFile_MultilineFormData(t *testing.T)
- func RunExecuteFile_MultilineQueryParameters(t *testing.T)
- func RunExecuteFile_MultipartFileUploads(t *testing.T)
- func RunExecuteFile_MultipleErrors(t *testing.T)
- func RunExecuteFile_MultipleRequests(t *testing.T)
- func RunExecuteFile_MultipleRequests_GreaterThanTwo(t *testing.T)
- func RunExecuteFile_NoRequestsInFile(t *testing.T)
- func RunExecuteFile_ParseError(t *testing.T)
- func RunExecuteFile_RequestWithError(t *testing.T)
- func RunExecuteFile_SimpleGetHTTP(t *testing.T)
- func RunExecuteFile_SingleRequest(t *testing.T)
- func RunExecuteFile_ValidThenInvalidSyntax(t *testing.T)
- func RunExecuteFile_VariableFunctionConsistency(t *testing.T)
- func RunExecuteFile_WithContactAndInternetFakerData(t *testing.T)
- func RunExecuteFile_WithCustomVariables(t *testing.T)
- func RunExecuteFile_WithDatetimeSystemVariables(t *testing.T)
- func RunExecuteFile_WithDotEnvSystemVariable(t *testing.T)
- func RunExecuteFile_WithExtendedRandomSystemVariables(t *testing.T)
- func RunExecuteFile_WithFakerPersonData(t *testing.T)
- func RunExecuteFile_WithGuidSystemVariable(t *testing.T)
- func RunExecuteFile_WithHttpClientEnvJson(t *testing.T)
- func RunExecuteFile_WithIndirectEnvironmentVariables(t *testing.T)
- func RunExecuteFile_WithIsoTimestampSystemVariable(t *testing.T)
- func RunExecuteFile_WithLocalDatetimeSystemVariable(t *testing.T)
- func RunExecuteFile_WithProcessEnvSystemVariable(t *testing.T)
- func RunExecuteFile_WithProgrammaticVariables(t *testing.T)
- func RunExecuteFile_WithRandomIntSystemVariable(t *testing.T)
- func RunExecuteFile_WithRestExtension(t *testing.T)
- func RunExecuteFile_WithTimestampSystemVariable(t *testing.T)
- func RunExtractHrespDefines(t *testing.T)
- func RunNewClient(t *testing.T)
- func RunNewClient_WithOptions(t *testing.T)
- func RunRedirectHandling(t *testing.T)
- func RunValidateResponses_BodyAnyDatetimePlaceholder(t *testing.T)
- func RunValidateResponses_BodyAnyGuidPlaceholder(t *testing.T)
- func RunValidateResponses_BodyAnyPlaceholder(t *testing.T)
- func RunValidateResponses_BodyAnyTimestampPlaceholder(t *testing.T)
- func RunValidateResponses_BodyContains(t *testing.T)
- func RunValidateResponses_BodyNotContains(t *testing.T)
- func RunValidateResponses_BodyRegexpPlaceholder(t *testing.T)
- func RunValidateResponses_Body_ExactMatch(t *testing.T)
- func RunValidateResponses_FileErrors(t *testing.T)
- func RunValidateResponses_Headers(t *testing.T)
- func RunValidateResponses_HeadersContain(t *testing.T)
- func RunValidateResponses_JSON_WhitespaceComparison(t *testing.T)
- func RunValidateResponses_JSON_WithPlaceholders(t *testing.T)
- func RunValidateResponses_JSON_WithPlaceholdersInBody(t *testing.T)
- func RunValidateResponses_NilAndEmptyActuals(t *testing.T)
- func RunValidateResponses_PartialExpected(t *testing.T)
- func RunValidateResponses_StatusCode(t *testing.T)
- func RunValidateResponses_StatusString(t *testing.T)
- func RunValidateResponses_WithSampleFile(t *testing.T)
- func TestExecuteFile_MultipleSystemVarsConsistency(t *testing.T)
- func TestExecuteFile_UuidVariableConsistency(t *testing.T)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractHrespDefines ¶
ExtractHrespDefines parses raw .hresp content to find @name=value definitions at the beginning of lines. These definitions are extracted and returned as a map. The function also returns the .hresp content with these definition lines removed.
Lines are trimmed of whitespace before checking for the "@" prefix. A valid definition requires an "=" sign. Example: "@token = mysecret". Lines that are successfully parsed as definitions are not included in the returned content string. Variable values in `@define` are treated literally; they are not resolved against other variables at this extraction stage.
func Ptr ¶
func Ptr[T any](v T) *T
Ptr returns a pointer to the given value. This is a generic helper useful for obtaining pointers to literals in tests.
func RunCookieJarHandling ¶
PRD-COMMENT: FR9.1 - Client Execution: Cookie Jar Management Corresponds to: Client execution behavior regarding HTTP cookies and the '@no-cookie-jar' request setting (http_syntax.md "Request Settings", "@no-cookie-jar"). This test verifies the client's cookie jar functionality. It checks:
- Default behavior: Cookies set by a server are stored in the client's cookie jar and sent with subsequent requests to the same domain.
- '@no-cookie-jar' directive: When a request includes the '@no-cookie-jar' setting, the client does not use its cookie jar for that specific request (neither sending stored cookies nor saving new ones from the response).
It uses dynamically created 'test/data/cookies_redirects/with_cookie_jar.http' and 'test/data/cookies_redirects/without_cookie_jar.http' files.
func RunCreateTestFileFromTemplate_DebugOutput ¶
PRD-COMMENT: TEST_HELPER_DEBUG_LOGGING - Test Utility: createTestFileFromTemplate Debug Output Corresponds to: Verifying the diagnostic logging capabilities of the `createTestFileFromTemplate` test helper function. This function is essential for preparing `.http` request files from templates for various tests. This test executes `createTestFileFromTemplate` using 'test/data/http_request_files/system_var_datetime.http' as a template and observes the `t.Logf` output generated by the helper, ensuring it provides useful debugging information during test execution and setup.
func RunExecuteFile_CapturesResponseHeaders ¶
PRD-COMMENT: FR10.8 - Client Core Execution: Response Header Capturing Corresponds to: Client's capability to accurately capture all HTTP response headers (http_syntax.md "Response Object"). This test uses 'test/data/http_request_files/captures_response_headers.http' to verify that the client correctly stores received headers, including multi-value headers, in the Response object.
func RunExecuteFile_ExternalFileNotFound ¶
PRD-COMMENT: FR4.4 - Request Body: External File Not Found Corresponds to: Client error handling when an external file referenced in a request body (e.g., via '<@ ./nonexistent.json') cannot be found (http_syntax.md "Request Body"). This test verifies that the client reports an appropriate error when attempting to process a request that references a non-existent external file.
func RunExecuteFile_ExternalFileWithEncoding ¶
PRD-COMMENT: FR4.3 - Request Body: External File with Encoding (<@|encoding) Corresponds to: Client's ability to process request bodies from external files with a specified character encoding using '<@|encoding filepath' (http_syntax.md "Request Body", "External File with Encoding (<@|encoding filepath)"). This test verifies that an external file ('test_encoded.txt') with a specific encoding (e.g., latin1) is correctly read and used as the request body.
func RunExecuteFile_ExternalFileWithVariables ¶
PRD-COMMENT: FR4.1 - Request Body: External File with Variables (<@) Corresponds to: Client's ability to process request bodies specified via '<@ filepath' where 'filepath' points to an external file whose content is subject to variable substitution (http_syntax.md "Request Body", "External File with Variables (<@ filepath)"). This test verifies that variables defined in the .http file or programmatically are correctly substituted into the content of the external file ('test_vars.json') before it's used as the request body.
func RunExecuteFile_ExternalFileWithVariablesAndEncoding ¶
PRD-COMMENT: FR4.5 / FR4.6 - Request Body: External File with Variables and Encoding (<@encoding) Corresponds to: Client's ability to process request bodies from external files with specified character encoding and variable substitution. This test verifies that variables are substituted into an encoded external file, and the resulting content is correctly sent to the server.
func RunExecuteFile_ExternalFileWithoutVariables ¶
PRD-COMMENT: FR4.2 - Request Body: External File Static (<) Corresponds to: Client's ability to process request bodies specified via '< filepath' where 'filepath' points to an external file whose content is included statically, without variable substitution (http_syntax.md "Request Body", "External File Static (< filepath)"). This test verifies that the content of the external file ('test_static.json') is used as the request body verbatim, with any variable-like syntax within it preserved literally.
func RunExecuteFile_GraphQLBasicQuery ¶
RunExecuteFile_GraphQLBasicQuery tests basic GraphQL query execution
func RunExecuteFile_GraphQLBatchQueries ¶
RunExecuteFile_GraphQLBatchQueries tests GraphQL batch query execution
func RunExecuteFile_GraphQLErrorHandling ¶
RunExecuteFile_GraphQLErrorHandling tests GraphQL error response handling
func RunExecuteFile_GraphQLFragments ¶
RunExecuteFile_GraphQLFragments tests GraphQL queries with fragments
func RunExecuteFile_GraphQLIntrospection ¶
RunExecuteFile_GraphQLIntrospection tests GraphQL introspection queries
func RunExecuteFile_GraphQLMutation ¶
RunExecuteFile_GraphQLMutation tests GraphQL mutation execution
func RunExecuteFile_GraphQLQueryWithVariables ¶
RunExecuteFile_GraphQLQueryWithVariables tests GraphQL queries with variables
func RunExecuteFile_IgnoreEmptyBlocks_Client ¶
PRD-COMMENT: FR2.4 - Parser: Request Separators and Comments / FR11.2 - Client Execution: Handling of Non-Request Content Corresponds to: Client and parser behavior regarding non-executable content within .http files, such as comments, empty blocks between request separators ('###'), and files containing only variable definitions (http_syntax.md "Request Separation", "Comments", "Variables"). This test suite verifies various scenarios: 1. Requests correctly parsed and executed when separated by comments or empty lines around separators. 2. Correct error handling (e.g., 'no requests found') for files that only contain variable definitions or are otherwise empty of executable requests. It uses test case templates from 'test/data/execute_file_ignore_empty_blocks/' (e.g., 'scenario_004_template.http', 'only_vars.http') to dynamically create test files.
func RunExecuteFile_InPlace_Malformed_NameOnlyNoEqualsNoValue ¶
PRD-COMMENT: FR3.9 - In-Place Variables: Malformed Definition (Name Only) Corresponds to: Parser and client robustness in handling malformed in-place variable definitions, specifically when only a name is provided (e.g., '@myvar' without '= value') (http_syntax.md "In-place Variables", implicitly by defining correct syntax). This test uses 'test/data/execute_inplace_vars/malformed_name_only/request.http' to verify that such malformed definitions are ignored or handled gracefully without causing execution failure for other valid requests.
func RunExecuteFile_InPlace_Malformed_NoNameEqualsValue ¶
PRD-COMMENT: FR3.9 - In-Place Variables: Malformed Definition (No Name) Corresponds to: Parser and client robustness in handling malformed in-place variable definitions, specifically when no name is provided (e.g., '@ = value') (http_syntax.md "In-place Variables", implicitly by defining correct syntax). This test uses 'test/data/execute_inplace_vars/malformed_no_name/request.http' to verify that such malformed definitions are ignored or handled gracefully.
func RunExecuteFile_InPlace_SimpleVariableInURL ¶
PRD-COMMENT: FR3.1, FR3.2 - In-Place Variables: Simple Definition and URL Substitution Corresponds to: Client's ability to define and use simple in-place variables (e.g., '@hostname = value', '@path_segment = /path') within an .http file and substitute them into the request URL (http_syntax.md "In-place Variables", "Variable Substitution"). This test uses 'test/data/execute_inplace_vars/simple_variable_in_url/request.http' to verify that variables like '@hostname' and '@path_segment' are correctly resolved and used to construct the final request URL.
func RunExecuteFile_InPlace_VariableDefinedByAnotherInPlaceVariable ¶
PRD-COMMENT: FR3.1, FR3.5 - In-Place Variables: Chained In-Place Variable Definition Corresponds to: Client's ability to resolve in-place variables that are defined by other in-place variables in a chain (e.g., '@var1 = val1', '@var2 = {{var1}}', '@var3 = {{var2}}') (http_syntax.md "In-place Variables"). This test uses 'test/data/execute_inplace_vars/variable_defined_by_another_inplace_variable/request.http' to verify chained resolution of '@host', '@path', and '@fullUrl'.
func RunExecuteFile_InPlace_VariableDefinedByAnotherVariable ¶
PRD-COMMENT: FR3.1, FR3.5 - In-Place Variables: Referencing Other In-Place Variables Corresponds to: Client's ability to define an in-place variable using the value of another in-place variable (e.g., '@base_url = http://server', '@full_url = {{base_url}}/path') (http_syntax.md "In-place Variables", "Variable Substitution"). This test uses 'test/data/execute_inplace_vars/variable_defined_by_another_variable/request.http' to verify that '@full_url' correctly resolves by substituting '@base_url'.
func RunExecuteFile_InPlace_VariableDefinedByDotEnvOsVariable ¶
PRD-COMMENT: FR3.1, FR3.8, FR1.4 - In-Place Variables: Referencing .env Variables via {{$dotenv}} Corresponds to: Client's ability to define an in-place variable using a variable from a .env file, accessed via '{{$dotenv VAR_NAME}}' (http_syntax.md "In-place Variables", "Environment Variables", ".env File Support"). This test uses 'test/data/execute_inplace_vars/variable_defined_by_dotenv_os_variable/request.http' and its associated '.env' file to verify that '@my_var' is correctly assigned the value of 'DOTENV_VAR' from the .env file.
func RunExecuteFile_InPlace_VariableDefinedByDotEnvSystemVariable ¶
PRD-COMMENT: FR3.1, FR3.8, FR1.3, FR1.4 - In-Place Variables: Referencing System Var via {{$dotenv}} (Conceptual - {{$dotenv}} is for OS/file env vars) Corresponds to: This test explores the interaction of {{$dotenv}} with system-like variable names. While {{$dotenv}} is primarily for OS/file environment variables, this tests if defining `@my_api_key = {{$dotenv DOTENV_VAR_FOR_SYSTEM_TEST}}` correctly pulls from a .env file. (http_syntax.md "In-place Variables", "Environment Variables", ".env File Support"). It uses 'test/data/execute_inplace_vars/inplace_variable_defined_by_dotenv_system_variable/ request.http' and its .env file.
func RunExecuteFile_InPlace_VariableDefinedByOsEnvVariable ¶
PRD-COMMENT: FR3.1, FR3.7, FR1.4 - In-Place Variables: Referencing OS Environment Variables Corresponds to: Client's ability to define an in-place variable using an OS environment variable (e.g., '@api_token = {{MY_API_TOKEN}}') (http_syntax.md "In-place Variables", "Environment Variables"). This test uses 'test/data/execute_inplace_vars/variable_defined_by_os_env_variable/request.http', sets an OS environment variable 'OS_VAR_TEST', and defines '@os_value = {{OS_VAR_TEST}}' to verify correct substitution.
func RunExecuteFile_InPlace_VariableDefinedByRandomInt ¶
PRD-COMMENT: FR3.1, FR3.6, FR1.3 - In-Place Variables: Referencing {{$randomInt}} Corresponds to: Client's ability to define an in-place variable using the '{{$randomInt MIN MAX}}' system variable (http_syntax.md "In-place Variables", "System Variables"). This test uses 'test/data/execute_inplace_vars/inplace_variable_defined_by_random_int/request.http' to verify that '@my_random_port' is correctly assigned a random integer within the specified range.
func RunExecuteFile_InPlace_VariableDefinedBySystemVariable ¶
PRD-COMMENT: FR3.1, FR3.6, FR1.3 - In-Place Variables: Referencing System Variables Corresponds to: Client's ability to define an in-place variable using a system variable (e.g., '@request_time = {{$timestamp}}') (http_syntax.md "In-place Variables", "System Variables"). This test uses 'test/data/execute_inplace_vars/variable_defined_by_system_variable/request.http' to verify that '@current_uuid' is correctly assigned a value from '{{$uuid}}'.
func RunExecuteFile_InPlace_VariableInAuthHeader ¶
PRD-COMMENT: FR3.1, FR3.3, FR5.1 - In-Place Variables: Authentication Header Substitution Corresponds to: Client's ability to use in-place variables within standard authentication headers like 'Authorization: Bearer {{token}}' (http_syntax.md "In-place Variables", "Authentication"). This test uses 'test/data/execute_inplace_vars/variable_in_auth_header/request.http' to verify that '@bearer_token' is correctly substituted into the 'Authorization' header.
func RunExecuteFile_InPlace_VariableInBody ¶
PRD-COMMENT: FR3.1, FR3.4 - In-Place Variables: Body Substitution Corresponds to: Client's ability to define in-place variables (e.g., '@user_id = 123') and substitute them into the request body (http_syntax.md "In-place Variables", "Variable Substitution"). This test uses 'test/data/execute_inplace_vars/variable_in_body/request.http' to verify that variables like '@item_name' and '@item_price' are correctly resolved and inserted into the JSON request body.
func RunExecuteFile_InPlace_VariableInCustomHeader ¶
PRD-COMMENT: FR3.1, FR3.3 - In-Place Variables: Custom Header Substitution Corresponds to: Client's ability to use in-place variables in custom request headers (e.g., 'X-Custom-ID: {{request_id}}') (http_syntax.md "In-place Variables", "Variable Substitution"). This test uses 'test/data/execute_inplace_vars/variable_in_custom_header/request.http' to verify that '@request_id_value' is correctly substituted into the 'X-Request-ID' header.
func RunExecuteFile_InPlace_VariableInHeader ¶
PRD-COMMENT: FR3.1, FR3.3 - In-Place Variables: Header Substitution Corresponds to: Client's ability to define in-place variables (e.g., '@api_key = mysecret') and substitute them into request headers (http_syntax.md "In-place Variables", "Variable Substitution"). This test uses 'test/data/execute_inplace_vars/variable_in_header/request.http' to verify that a variable like '@auth_token' is correctly resolved and inserted into the 'Authorization' header.
func RunExecuteFile_InPlace_VariableInJsonRequestBody ¶
Corresponds to: Client's ability to substitute in-place variables into a JSON request body, ensuring correct JSON structure is maintained (http_syntax.md "In-place Variables", "Request Body"). This test uses 'test/data/execute_inplace_vars/variable_in_json_request_body/request.http' to verify substitution of '@user_name' and '@user_age' (an integer) into a JSON payload.
func RunExecuteFile_InPlace_VariablePrecedenceOverEnvironment ¶
PRD-COMMENT: FR1.5, FR3.1 - Variable Precedence: In-Place over Environment Corresponds to: The rule that in-place variables defined in an .http file take precedence over environment variables with the same name (http_syntax.md "Variables", "Variable Precedence"). This test uses 'test/data/execute_inplace_vars/variable_precedence_over_environment/request.http', sets an OS environment variable 'ENV_VAR_PRECEDENCE', and defines an in-place variable '@ENV_VAR_PRECEDENCE' to verify that the in-place definition is used.
func RunExecuteFile_InPlace_VariableSubstitutionInBody ¶
PRD-COMMENT: FR3.1, FR3.4 - In-Place Variables: Complex Body Substitution Corresponds to: Client's ability to substitute multiple in-place variables into various parts of a structured request body (e.g., JSON) (http_syntax.md "In-place Variables", "Variable Substitution"). This test uses 'test/data/execute_inplace_vars/variable_substitution_in_body/request.http' to verify substitution of '@username' and '@product_id' into a JSON request body.
func RunExecuteFile_InvalidMethodInFile ¶
PRD-COMMENT: FR11.1 - Client Execution: Invalid HTTP Method Handling Corresponds to: Client robustness in handling syntactically incorrect HTTP methods within a .http file (http_syntax.md, implicitly by defining valid methods). This test verifies that the client correctly identifies an invalid HTTP method in 'test/data/http_request_files/invalid_method.http', reports an error for that request, and handles the overall execution flow appropriately (e.g., by aggregating errors).
func RunExecuteFile_MultilineFormData ¶
PRD-COMMENT: G2 - Multi-line Form Data Corresponds to: VS Code REST Client syntax for multi-line form data using & line continuations (http_syntax.md "Form Data on Multiple Lines"). This test verifies that the client can parse and execute requests with form data spread across multiple lines using the VS Code REST Client syntax.
func RunExecuteFile_MultilineQueryParameters ¶
PRD-COMMENT: G1 - Multi-line Query Parameters Corresponds to: VS Code REST Client syntax for multi-line query parameters using ? and & line continuations (http_syntax.md "Query Parameters on Multiple Lines"). This test verifies that the client can parse and execute requests with query parameters spread across multiple lines using the VS Code REST Client syntax.
func RunExecuteFile_MultipartFileUploads ¶
PRD-COMMENT: G3 - File Uploads in Multipart Forms Corresponds to: File upload functionality within multipart forms using < file references (http_syntax.md "File Upload"). This test verifies that the client can parse and execute multipart form requests that include file uploads using the < file reference syntax.
func RunExecuteFile_MultipleErrors ¶
PRD-COMMENT: FR10.7 - Client Core Execution: Multiple Execution Errors Corresponds to: Client's ability to handle and aggregate multiple errors if several requests within a single file fail during execution (http_syntax.md). This test uses 'test/data/http_request_files/multiple_errors.http' (containing requests designed to fail) to verify that each failing request's error is captured in its respective response object and that an aggregated error is returned by ExecuteFile.
func RunExecuteFile_MultipleRequests ¶
PRD-COMMENT: FR10.2 - Client Core Execution: Multiple Requests Corresponds to: Client capability to parse and execute multiple sequential HTTP requests from a single .http file (http_syntax.md "Request Separation"). This test verifies that the client can execute all requests in 'test/data/http_request_files/multiple_requests.http', collect all responses, and optionally validate them against 'test/data/http_response_files/client_multiple_requests_expected.hresp'.
func RunExecuteFile_MultipleRequests_GreaterThanTwo ¶
PRD-COMMENT: FR10.10 - Client Core Execution: Multiple Requests (Extended) Corresponds to: Robustness of client in handling .http files with more than two requests, ensuring all are processed sequentially (http_syntax.md "Request Separation"). This test uses 'test/data/http_request_files/multiple_requests_gt2.http' and validates responses against 'test/data/http_response_files/multiple_responses_gt2_expected.http' to ensure the client can handle a larger number of requests in a file.
func RunExecuteFile_NoRequestsInFile ¶
PRD-COMMENT: FR10.5 - Client Core Execution: Empty Request File Corresponds to: Client behavior when processing a .http file that syntactically parses but contains no actual HTTP requests (http_syntax.md). This test uses 'test/data/http_request_files/no_requests.http' to verify that the client correctly identifies that no requests are present and returns an appropriate error or empty response set.
func RunExecuteFile_ParseError ¶
PRD-COMMENT: FR10.4 - Client Core Execution: File Parse Error Handling Corresponds to: Client error handling when a .http file has parsing issues, such as no valid requests found (http_syntax.md). This test verifies that the client reports a suitable error if the provided file 'test/data/http_request_files/parse_error.http' (which is expected to be empty or syntactically invalid to the point of yielding no requests) cannot be successfully parsed into executable requests.
func RunExecuteFile_RequestWithError ¶
PRD-COMMENT: FR10.3 - Client Core Execution: Request Execution Error Handling Corresponds to: Client error handling for individual request failures during execution of a multi-request file (http_syntax.md). This test verifies that if a request in 'test/data/http_request_files/request_with_error.http' fails (e.g., network error), the client reports the error for that specific request but continues to process subsequent requests. The overall operation should also report an aggregated error.
func RunExecuteFile_SimpleGetHTTP ¶
PRD-COMMENT: FR10.9 - Client Core Execution: Basic HTTP GET Corresponds to: Client's ability to execute a simple GET request over plain HTTP using a mock transport (http_syntax.md). This test uses 'test/data/http_request_files/simple_get.http' and a mock HTTP transport to verify the fundamental request execution flow, ensuring the correct method, URL, and headers are prepared and sent.
func RunExecuteFile_SingleRequest ¶
PRD-COMMENT: FR10.1 - Client Core Execution: Single Request Corresponds to: Basic client capability to parse and execute a single valid HTTP request from a .http file (http_syntax.md). This test verifies that the client can successfully execute one request defined in 'test/data/http_request_files/single_request.http' and retrieve the response.
func RunExecuteFile_ValidThenInvalidSyntax ¶
PRD-COMMENT: FR10.6 - Client Core Execution: Mixed Validity Parse Error Corresponds to: Client behavior when a .http file contains a mix of valid requests followed by content that causes a parsing error (http_syntax.md). This test uses 'test/data/http_request_files/valid_then_invalid_syntax.http' to ensure the client executes valid requests up to the point of the parse error and then reports the parsing error, potentially halting further execution from that file.
func RunExecuteFile_VariableFunctionConsistency ¶
PRD-COMMENT: FR1.6 - Variable Function Consistency (Internal) Corresponds to: Ensuring internal consistency between how variables are resolved by the dedicated variable substitution functions and how they are resolved during a full ExecuteFile operation. This is more of an internal consistency check than a direct user-facing feature test. This test compares the output of `SubstituteVariablesInString` with the actual substituted values observed in a request made via `ExecuteFile`, using 'test/data/http_request_files/variable_consistency.http'.
func RunExecuteFile_WithContactAndInternetFakerData ¶
PRD-COMMENT: G5 Phase 1 - Enhanced Faker Library: Contact and Internet Data Corresponds to: Client's ability to substitute enhanced faker variables for contact data (phone, address, city, state, zip, country) and internet data (URL, domain, user agent, MAC). This test verifies that both VS Code style and JetBrains style syntaxes work correctly and generate realistic contact and internet data for API testing scenarios.
func RunExecuteFile_WithCustomVariables ¶
PRD-COMMENT: FR1.1 - Custom Variables: Basic Definition and Substitution Corresponds to: Client's ability to define and substitute custom variables within an .http file (e.g., @name = value) (http_syntax.md "Custom Variables"). This test uses 'test/data/http_request_files/custom_variables.http' to verify substitution of custom variables in URLs, headers, and bodies.
func RunExecuteFile_WithDatetimeSystemVariables ¶
PRD-COMMENT: FR1.3.4 - System Variables: {{$datetime "format" [offset]}} Corresponds to: Client's ability to substitute the {{$datetime}} system variable with the current timestamp formatted according to a Go layout string, optionally with a timezone offset (http_syntax.md "System Variables"). This test uses 'test/data/http_request_files/system_var_datetime.http' to verify various datetime formats (RFC3339, custom, with local/UTC/specific offsets) in URLs, headers, and bodies. It ensures multiple instances resolve to the same request-scoped timestamp (respecting their individual formatting and offsets).
func RunExecuteFile_WithDotEnvSystemVariable ¶
PRD-COMMENT: FR1.3.7 - System Variables: {{$dotenv.VAR_NAME}} Corresponds to: Client's ability to substitute the {{$dotenv.VAR_NAME}} system variable with values from a .env file located in the same directory as the .http file (http_syntax.md "System Variables"). This test uses 'test/data/http_request_files/system_var_dotenv.http' and a dynamically created '.env' file to verify substitution in URLs, headers, and bodies. It also checks behavior for variables not present in the .env file.
func RunExecuteFile_WithExtendedRandomSystemVariables ¶
PRD-COMMENT: FR1.3.8 - System Variables: {{$random.*}} Corresponds to: Client's ability to substitute extended random system variables like {{$random.integer MIN MAX}}, {{$random.float MIN MAX}}, {{$random.alphabetic LENGTH}}, {{$random.alphanumeric LENGTH}}, {{$random.hexadecimal LENGTH}}, {{$random.email}} (http_syntax.md "System Variables - Extended Random"). This test uses 'test/data/http_request_files/system_var_extended_random.http' to verify the generation and substitution of these extended random variables, including handling of arguments and invalid inputs.
func RunExecuteFile_WithFakerPersonData ¶
PRD-COMMENT: G5 - Comprehensive Faker Library Support: Person/Identity Data Corresponds to: Client's ability to substitute comprehensive faker variables for person data including {{$randomFirstName}}, {{$randomLastName}}, {{$randomFullName}}, and {{$randomJobTitle}}. This test verifies that both VS Code style ({{$randomFirstName}}) and JetBrains style ({{$random.firstName}}) syntaxes work correctly and generate realistic person data.
func RunExecuteFile_WithGuidSystemVariable ¶
PRD-COMMENT: FR1.3.1 - System Variables: {{$guid}} and {{$uuid}} Corresponds to: Client's ability to substitute {{$guid}} and {{$uuid}} system variables with a unique, request-scoped UUID (http_syntax.md "System Variables"). This test uses 'test/data/http_request_files/system_var_guid.http' to verify that these variables are correctly generated and substituted in URLs, headers, and bodies. It also confirms that multiple instances of {{$guid}} or {{$uuid}} within the same request resolve to the *same* generated UUID for that request.
func RunExecuteFile_WithHttpClientEnvJson ¶
PRD-COMMENT: FR1.4 - Environment Configuration Files: http-client.env.json Corresponds to: Client's ability to load and substitute variables from `http-client.env.json` and `http-client.private.env.json` files, respecting environment-specific configurations (e.g., "dev", "prod") (http_syntax.md "Environment Configuration Files"). This test suite uses various .http files and dynamically created `http-client.env.json` / `http-client.private.env.json` files to verify variable loading, substitution, environment selection, and precedence for different scenarios (Task T4).
func RunExecuteFile_WithIndirectEnvironmentVariables ¶
PRD-COMMENT: G8 - Indirect Environment Variable Lookup: {{$processEnv %VAR}} Corresponds to: Client's ability to substitute indirect environment variables using the {{$processEnv %VAR}} syntax where VAR is a variable containing the name of the environment variable to look up. This provides dynamic environment variable selection.
func RunExecuteFile_WithIsoTimestampSystemVariable ¶
PRD-COMMENT: FR1.3.3 - System Variables: {{$isoTimestamp}} Corresponds to: Client's ability to substitute the {{$isoTimestamp}} system variable with the current UTC timestamp in ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ) (http_syntax.md "System Variables"). This test uses 'test/data/http_request_files/system_var_iso_timestamp.http' to verify correct substitution in URLs, headers, and bodies, and checks that multiple instances resolve to the same request-scoped timestamp.
func RunExecuteFile_WithLocalDatetimeSystemVariable ¶
PRD-COMMENT: FR1.3.4.1 - System Variables: {{$localDatetime "format"}} Corresponds to: Client's ability to substitute the {{$localDatetime}} system variable with the current timestamp in the system's local timezone, formatted according to a Go layout string (http_syntax.md "System Variables"). This test uses 'test/data/http_request_files/system_var_local_datetime.http' to verify correct formatting and substitution in URLs, headers, and bodies.
func RunExecuteFile_WithProcessEnvSystemVariable ¶
PRD-COMMENT: FR1.3.6 - System Variables: {{$processEnv.VAR_NAME}} Corresponds to: Client's ability to substitute the {{$processEnv.VAR_NAME}} system variable with the value of an OS environment variable (http_syntax.md "System Variables"). This test uses 'test/data/http_request_files/system_var_process_env.http' and sets OS environment variables to verify their substitution in URLs, headers, and bodies. It also checks behavior for undefined environment variables.
func RunExecuteFile_WithProgrammaticVariables ¶
PRD-COMMENT: FR1.5 - Programmatic Variable Injection Corresponds to: Client's ability to accept and substitute variables passed programmatically during the ExecuteFile call, which can override variables defined in the .http file or environment files (http_syntax.md "Variable Precedence"). This test uses 'test/data/http_request_files/programmatic_vars.http' and injects variables via `WithVariables` and `ExecuteFile` options to verify their substitution and precedence over file-defined variables.
func RunExecuteFile_WithRandomIntSystemVariable ¶
PRD-COMMENT: FR1.3.5 - System Variables: {{$randomInt [MIN MAX]}} Corresponds to: Client's ability to substitute the {{$randomInt}} system variable with a random integer. Supports optional MIN and MAX arguments. If no args, defaults to a wide range. If MIN > MAX, or args are malformed, the literal placeholder is used. (http_syntax.md "System Variables"). This test suite uses various .http files (e.g., 'system_var_randomint_valid_args.http', 'system_var_randomint_no_args.http') to verify behavior with valid arguments, no arguments, swapped arguments (min > max), and malformed arguments, checking substitution in URLs, headers, and bodies.
func RunExecuteFile_WithRestExtension ¶
PRD-COMMENT: FR1.1 - File Type: .rest extension support Corresponds to: Client's ability to parse and execute request files with the .rest extension, as an alternative to .http (http_syntax.md "File Structure", "File Extension"). This test verifies that a simple GET request defined in a .rest file is correctly executed.
func RunExecuteFile_WithTimestampSystemVariable ¶
PRD-COMMENT: FR1.3.2 - System Variables: {{$timestamp}} Corresponds to: Client's ability to substitute the {{$timestamp}} system variable with the current Unix timestamp (seconds since epoch) (http_syntax.md "System Variables"). This test uses 'test/data/http_request_files/system_var_timestamp.http' to verify correct substitution in URLs, headers, and bodies. It ensures multiple instances resolve to the same request-scoped timestamp.
func RunExtractHrespDefines ¶
func RunNewClient ¶
PRD-COMMENT: FR_CLIENT_INIT_DEFAULT - Client Initialization: Default Corresponds to: The ability to create a new HTTP client instance with default configurations (e.g., standard http.Client, no base URL, empty default headers). This test verifies that `rc.NewClient()` without options returns a valid client with expected default values.
func RunNewClient_WithOptions ¶
PRD-COMMENT: FR_CLIENT_INIT_OPTIONS - Client Initialization: With Options Corresponds to: The ability to create a new HTTP client instance configured with specific options, such as a custom underlying `http.Client` (FR_CLIENT_CONFIG_HTTPCLIENT), a base URL (FR_CLIENT_CONFIG_BASEURL), and default headers (FR_CLIENT_CONFIG_HEADERS). This test verifies that `rc.NewClient()` with options (e.g., `WithHTTPClient`, `WithBaseURL`, `WithDefaultHeader`) correctly applies these configurations to the new client instance. It also checks that providing a nil http.Client results in a default client being used.
func RunRedirectHandling ¶
PRD-COMMENT: FR9.2 - Client Execution: Redirect Handling Corresponds to: Client execution behavior regarding HTTP redirects and the '@no-redirect' request setting (http_syntax.md "Request Settings", "@no-redirect"). This test verifies the client's redirect handling. It checks:
- Default behavior: The client automatically follows HTTP redirects (e.g., 302 Found).
- '@no-redirect' directive: When a request includes the '@no-redirect' setting, the client does not automatically follow redirects and instead returns the redirect response itself.
It uses dynamically created 'test/data/cookies_redirects/with_redirect.http' and 'test/data/cookies_redirects/without_redirect.http' files.
func RunValidateResponses_BodyContains ¶
Since ParseExpectedResponseFile does not populate ExpectedResponse.BodyContains, this test verifies that the BodyContains logic in ValidateResponses is benign (doesn't cause errors) when the expected response comes from a file.
func RunValidateResponses_BodyNotContains ¶
TestValidateResponses_BodyNotContains is similar to BodyContains. It verifies that BodyNotContains logic in ValidateResponses is benign when the expected response comes from a file, as the file cannot specify BodyNotContains.
func RunValidateResponses_HeadersContain ¶
TestValidateResponses_HeadersContain verifies that HeadersContain logic in ValidateResponses is benign when the expected response comes from a file, as the file cannot specify HeadersContain.
func RunValidateResponses_JSON_WhitespaceComparison ¶ added in v0.0.8
RunValidateResponses_JSON_WhitespaceComparison tests JSON comparison with different whitespace
func RunValidateResponses_JSON_WithPlaceholders ¶ added in v0.0.8
RunValidateResponses_JSON_WithPlaceholders tests JSON comparison with placeholders
func RunValidateResponses_JSON_WithPlaceholdersInBody ¶ added in v0.0.9
RunValidateResponses_JSON_WithPlaceholdersInBody tests JSON comparison when actual response contains placeholders
func TestExecuteFile_MultipleSystemVarsConsistency ¶ added in v0.0.6
TestExecuteFile_MultipleSystemVarsConsistency tests that multiple system variables defined in file-scoped variables maintain consistency across all requests in the file
func TestExecuteFile_UuidVariableConsistency ¶ added in v0.0.6
TestExecuteFile_UuidVariableConsistency tests that a variable defined as @scenarioId = {{$uuid}} maintains the same value throughout all uses in the file. This test verifies that once a variable is assigned a system variable value like {{$uuid}}, that value should be consistent across all requests within the same file execution.
Types ¶
This section is empty.
Source Files
¶
- client_cookies_redirects.go
- client_execute_core.go
- client_execute_edgecases.go
- client_execute_external_file.go
- client_execute_graphql.go
- client_execute_inplace_vars.go
- client_execute_multiple_system_vars_consistency.go
- client_execute_system_vars.go
- client_execute_uuid_consistency.go
- client_execute_vars.go
- client_init.go
- client_test_helpers.go
- hresp_vars.go
- json_validator_tests.go
- test_helpers.go
- validator_body.go
- validator_general.go
- validator_headers.go
- validator_placeholders.go
- validator_setup.go
- validator_status.go
- validator_test_helpers.go