tests/httpapiex_ut/httpapiex_ut.c
/*every time HttpApi_Execute request is executed several things will be auto-aupdated by the code*/
/*request headers to match the content-length, host to match hostname*/
every time HttpApi_Execute request is executed several things will be auto-aupdated by the code
request headers to match the content-length, host to match hostname
every time HttpApi_Execute request is executed several things will be auto - aupdated by the code request headers to match the content - length host to match hostname
static void prepareHTTPAPIEX_ExecuteRequest(unsigned int *asGivenByHttpApi, HTTP_HEADERS_HANDLE requestHttpHeaders, HTTP_HEADERS_HANDLE responseHttpHeaders, BUFFER_HANDLE responseHttpBody, HTTPAPI_RESULT resultToBeUsed)
{
    STRICT_EXPECTED_CALL(BUFFER_length(IGNORED_PTR_ARG))
        .IgnoreArgument(1).SetReturn(TEST_BUFFER_SIZE);
    STRICT_EXPECTED_CALL(size_tToString(IGNORED_PTR_ARG, IGNORED_NUM_ARG, TEST_BUFFER_SIZE))
        .IgnoreArgument(1).IgnoreArgument(2);
    STRICT_EXPECTED_CALL(STRING_c_str(IGNORED_PTR_ARG))
        .IgnoreArgument(1);
    STRICT_EXPECTED_CALL(HTTPHeaders_ReplaceHeaderNameValuePair(IGNORED_PTR_ARG, "Host", TEST_HOSTNAME))
        .IgnoreArgument(1);
    STRICT_EXPECTED_CALL(HTTPHeaders_ReplaceHeaderNameValuePair(IGNORED_PTR_ARG, "Content-Length", MU_TOSTRING(TEST_BUFFER_SIZE)))
        .IgnoreArgument(1);
    STRICT_EXPECTED_CALL(BUFFER_length(IGNORED_PTR_ARG))
        .IgnoreArgument(1).SetReturn(TEST_BUFFER_SIZE);
    STRICT_EXPECTED_CALL(BUFFER_u_char(IGNORED_PTR_ARG))
        .IgnoreArgument(1).SetReturn(TEST_BUFFER);
    STRICT_EXPECTED_CALL(HTTPAPI_ExecuteRequest(
        IGNORED_PTR_ARG,
        HTTPAPI_REQUEST_HEAD,
        TEST_RELATIVE_PATH,
        requestHttpHeaders,
        IGNORED_PTR_ARG,
        TEST_BUFFER_SIZE,
        IGNORED_PTR_ARG,
        responseHttpHeaders,
        responseHttpBody))
        .IgnoreArgument(1)
        .IgnoreArgument(4)
        .IgnoreArgument(5)
        .IgnoreArgument(7)
        .ValidateArgumentBuffer(5, TEST_BUFFER, TEST_BUFFER_SIZE)
        .CopyOutArgumentBuffer(7, asGivenByHttpApi, sizeof(*asGivenByHttpApi))
        .SetReturn(resultToBeUsed);
}
static void prepareHTTPAPIEX_ExecuteRequest ( unsigned int * asGivenByHttpApi , HTTP_HEADERS_HANDLE requestHttpHeaders , HTTP_HEADERS_HANDLE responseHttpHeaders , BUFFER_HANDLE responseHttpBody , HTTPAPI_RESULT resultToBeUsed ) { STRICT_EXPECTED_CALL ( BUFFER_length ( IGNORED_PTR_ARG ) ) . IgnoreArgument ( 1 ) . SetReturn ( TEST_BUFFER_SIZE ) ; STRICT_EXPECTED_CALL ( size_tToString ( IGNORED_PTR_ARG , IGNORED_NUM_ARG , TEST_BUFFER_SIZE ) ) . IgnoreArgument ( 1 ) . IgnoreArgument ( 2 ) ; STRICT_EXPECTED_CALL ( STRING_c_str ( IGNORED_PTR_ARG ) ) . IgnoreArgument ( 1 ) ; STRICT_EXPECTED_CALL ( HTTPHeaders_ReplaceHeaderNameValuePair ( IGNORED_PTR_ARG , " " , TEST_HOSTNAME ) ) . IgnoreArgument ( 1 ) ; STRICT_EXPECTED_CALL ( HTTPHeaders_ReplaceHeaderNameValuePair ( IGNORED_PTR_ARG , " " , MU_TOSTRING ( TEST_BUFFER_SIZE ) ) ) . IgnoreArgument ( 1 ) ; STRICT_EXPECTED_CALL ( BUFFER_length ( IGNORED_PTR_ARG ) ) . IgnoreArgument ( 1 ) . SetReturn ( TEST_BUFFER_SIZE ) ; STRICT_EXPECTED_CALL ( BUFFER_u_char ( IGNORED_PTR_ARG ) ) . IgnoreArgument ( 1 ) . SetReturn ( TEST_BUFFER ) ; STRICT_EXPECTED_CALL ( HTTPAPI_ExecuteRequest ( IGNORED_PTR_ARG , HTTPAPI_REQUEST_HEAD , TEST_RELATIVE_PATH , requestHttpHeaders , IGNORED_PTR_ARG , TEST_BUFFER_SIZE , IGNORED_PTR_ARG , responseHttpHeaders , responseHttpBody ) ) . IgnoreArgument ( 1 ) . IgnoreArgument ( 4 ) . IgnoreArgument ( 5 ) . IgnoreArgument ( 7 ) . ValidateArgumentBuffer ( 5 , TEST_BUFFER , TEST_BUFFER_SIZE ) . CopyOutArgumentBuffer ( 7 , asGivenByHttpApi , sizeof ( * asGivenByHttpApi ) ) . SetReturn ( resultToBeUsed ) ; }
every time HttpApi_Execute request is executed several things will be auto-aupdated by the code
request headers to match the content-length, host to match hostname
every time HttpApi_Execute request is executed several things will be auto - aupdated by the code request headers to match the content - length host to match hostname
/*this is building the host and content-length for the http request headers, this happens every time*/