MCPcopy Create free account
hub / github.com/SmingHub/Sming / sendDataStream

Method sendDataStream

Sming/Components/Network/src/Network/Http/HttpResponse.cpp:105–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105bool HttpResponse::sendDataStream(IDataSourceStream* newDataStream, const String& reqContentType)
106{
107 setStream(newDataStream);
108 if(newDataStream == nullptr || !newDataStream->isValid()) {
109 code = HTTP_STATUS_NOT_FOUND;
110 freeStreams();
111 return false;
112 }
113
114 if(reqContentType) {
115 setContentType(reqContentType);
116 }
117
118 if(!headers.contains(HTTP_HEADER_TRANSFER_ENCODING) && stream->available() < 0) {
119 headers[HTTP_HEADER_TRANSFER_ENCODING] = _F("chunked");
120 }
121
122 return true;
123}
124
125void HttpResponse::reset()
126{

Callers 15

onAjaxInputFunction · 0.45
onAjaxFrequencyFunction · 0.45
onApiSensorsFunction · 0.45
onApiOutputFunction · 0.45
onAjaxNetworkListFunction · 0.45
onAjaxConnectFunction · 0.45
onFileFunction · 0.45
onConfigurationJsonFunction · 0.45
onAjaxGetStateFunction · 0.45
onStreamFunction · 0.45
sendFileFunction · 0.45
onConfigurationJsonFunction · 0.45

Calls 3

isValidMethod · 0.45
containsMethod · 0.45
availableMethod · 0.45

Tested by

no test coverage detected