void MediaInfo InitFromURLRequest const net URLRequest request DCHECK

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
void MediaInfo::InitFromURLRequest(const net::URLRequest* request) {
DCHECK(request);
const net::UploadDataStream* data_stream = request->get_upload();
if (data_stream && data_stream->GetElementReaders()) {
DCHECK_LT(data_stream->GetElementReaders()->size(), 2);
if (data_stream->GetElementReaders()->size() == 1) {
const auto reader = (*data_stream->GetElementReaders())[0]->AsBytesReader();
if (reader)
post_data_.assign(reader->bytes(), reader->length());
}
}
request_url_ = request->url().spec();
}