MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / sendRedirect

Method sendRedirect

Libraries/Http/HttpConnection.cpp:1198–1206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1196}
1197
1198Result HttpResponse::sendRedirect(int code, StringSpan location)
1199{
1200 SC_TRY_MSG(code >= 300 and code <= 399, "HttpResponse redirect status must be 3xx");
1201 SC_TRY_MSG(not location.isEmpty(), "HttpResponse redirect location must not be empty");
1202 SC_TRY(startBody(code, 0));
1203 SC_TRY(addHeader("Location", location));
1204 SC_TRY(sendHeaders());
1205 return end();
1206}
1207
1208void HttpResponse::grabUnusedHeaderMemory(HttpRequest& request) { setHeaderMemory(request.getUnusedHeaderMemory()); }
1209

Callers 2

responseBodyHelpersMethod · 0.80

Calls 2

endFunction · 0.85
isEmptyMethod · 0.45

Tested by 2

responseBodyHelpersMethod · 0.64