// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #if WITH_WINHTTP #include "CoreMinimal.h" #include "Interfaces/IHttpResponse.h" #include "Containers/Queue.h" /** * WinHttp implementation of an HTTP response */ class FWinHttpHttpResponse : public IHttpResponse { public: FWinHttpHttpResponse(const FString& InUrl, const EHttpResponseCodes::Type InHttpStatusCode, TMap&& InHeaders, TArray&& InPayload); virtual ~FWinHttpHttpResponse() = default; //~ Begin IHttpBase Interface virtual FString GetURL() const override; virtual FString GetURLParameter(const FString& ParameterName) const override; virtual FString GetHeader(const FString& HeaderName) const override; virtual TArray GetAllHeaders() const override; virtual FString GetContentType() const override; virtual int32 GetContentLength() const override; virtual const TArray& GetContent() const override; //~ End IHttpBase Interface //~ Begin IHttpResponse Interface virtual int32 GetResponseCode() const override; virtual FString GetContentAsString() const override; //~ End IHttpResponse Interface void AppendHeader(const FString& HeaderKey, const FString& HeaderValue) { Headers.Add(HeaderKey, HeaderValue); } void AppendPayload(const TArray& InPayload) { Payload.Append(InPayload); } protected: /** The URL we requested data from*/ FString Url; /** Cached code from completed response */ EHttpResponseCodes::Type HttpStatusCode; /** Cached key/value header pairs. Parsed once request completes. Only accessible on the game thread. */ TMap Headers; /** Byte array of the data we received */ TArray Payload; }; #endif // WITH_WINHTTP