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

Function HttpWriteBearerAuthorization

Libraries/Http/HttpHeaders.cpp:604–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

602}
603
604Result HttpWriteBearerAuthorization(StringSpan token, Span<char> storage, StringSpan& output)
605{
606 output = {};
607 size_t offset = 0;
608 SC_TRY_MSG(not token.isEmpty(), "Bearer authorization token is empty");
609 SC_TRY_MSG(HttpHeaderInternal::appendTo(storage, offset, "Bearer "), "Authorization output buffer is too small");
610 SC_TRY_MSG(HttpHeaderInternal::appendTo(storage, offset, token), "Authorization output buffer is too small");
611 output = {{storage.data(), offset}, false, StringEncoding::Ascii};
612 return Result(true);
613}
614
615Result HttpWriteBasicAuthorization(StringSpan base64Credentials, Span<char> storage, StringSpan& output)
616{

Callers 1

headerBuildersMethod · 0.85

Calls 3

ResultClass · 0.50
isEmptyMethod · 0.45
dataMethod · 0.45

Tested by 1

headerBuildersMethod · 0.68