1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ios/net/nsurlrequest_util.h"
7 #include "base/strings/stringprintf.h"
11 std::string FormatUrlRequestForLogging(NSURLRequest* request) {
12 NSString* urlAbsoluteString = request.URL.absoluteString;
13 NSString* mainDocumentURLAbsoluteString =
14 request.mainDocumentURL.absoluteString;
15 return base::StringPrintf(
16 "request: %s request.mainDocURL: %s",
17 urlAbsoluteString ? urlAbsoluteString.UTF8String : "[nil]",
18 mainDocumentURLAbsoluteString ?
19 mainDocumentURLAbsoluteString.UTF8String : "[nil]");