Files
UnrealEngineUWP/Engine/Source/Runtime/Online/HTTP/Private/WinHttp/WinHttpHttpResponse.h
Marc Audy 68150e0be7 Merge UE5/Release-Engine-Staging to UE5/Main @ 14611496
This represents UE4/Main @ 14594913

[CL 14612291 by Marc Audy in ue5-main branch]
2020-10-29 13:38:15 -04:00

50 lines
1.7 KiB
C++

// 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<FString, FString>&& InHeaders, TArray<uint8>&& 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<FString> GetAllHeaders() const override;
virtual FString GetContentType() const override;
virtual int32 GetContentLength() const override;
virtual const TArray<uint8>& 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<uint8>& 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<FString, FString> Headers;
/** Byte array of the data we received */
TArray<uint8> Payload;
};
#endif // WITH_WINHTTP