helpers.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #pragma once
  2. #include "fwd.h"
  3. #include "http.h"
  4. #include <util/generic/fwd.h>
  5. namespace NYT {
  6. ////////////////////////////////////////////////////////////////////////////////
  7. TString CreateHostNameWithPort(const TString& name, const TClientContext& context);
  8. TString GetFullUrl(const TString& hostName, const TClientContext& context, THttpHeader& header);
  9. void UpdateHeaderForProxyIfNeed(const TString& hostName, const TClientContext& context, THttpHeader& header);
  10. TString GetFullUrlForProxy(const TString& hostName, const TClientContext& context, THttpHeader& header);
  11. TString TruncateForLogs(const TString& text, size_t maxSize);
  12. TString GetLoggedAttributes(const THttpHeader& header, const TString& url, bool includeParameters, size_t sizeLimit);
  13. void LogRequest(const THttpHeader& header, const TString& url, bool includeParameters, const TString& requestId, const TString& hostName);
  14. // Sometimes errors may not include any specific inner errors and appear to be generic.
  15. // To differentiate these errors and reduce reliance on HTTP status codes, we need to extend inner error information.
  16. //
  17. // XXX(hiddenpath): Remove this method when server will respond with specific errors.
  18. void ExtendGenericError(TErrorResponse& errorResponse, int code, TString message);
  19. ////////////////////////////////////////////////////////////////////////////////
  20. } // namespace NYT