MCPcopy Create free account
hub / github.com/acidicoala/SmokeAPI / SetHTTPRequestRawPostBody

Function SetHTTPRequestRawPostBody

static/smoke_api/interfaces/steam_http.cpp:79–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77 }
78
79 bool SetHTTPRequestRawPostBody(
80 const std::string& function_name,
81 const HTTPRequestHandle hRequest,
82 const char* pchContentType,
83 const uint8_t* pubBody,
84 const uint32_t unBodyLen,
85 const std::function<bool()>& original_function
86 ) noexcept {
87 try {
88 const auto result = original_function();
89
90 if(config::get().log_steam_http) {
91 const std::string_view content_type =
92 pchContentType ? pchContentType : "smoke_api::N/A";
93
94 const std::string_view buffer =
95 pubBody && unBodyLen
96 ? std::string_view(reinterpret_cast<const char*>(pubBody), unBodyLen)
97 : "";
98
99 LOG_INFO(
100 "{} -> handle: {}, content-type: {}, size: {}, buffer:\n{}",
101 function_name,
102 hRequest,
103 content_type,
104 unBodyLen,
105 buffer
106 );
107 }
108
109 return result;
110 } catch(const std::exception& e) {
111 LOG_ERROR("{} -> Error: {}", __func__, e.what());
112 return false;
113 }
114 }
115}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected