blob: 2a22b9fa5a1803f4d99071f44515d61dff94e9c5 [file] [log] [blame]
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:convert';
/// Adds additional query parameters to [url], overwriting the original
/// parameters if a name conflict occurs.
Uri addQueryParameters(Uri url, Map<String, String> parameters) => url.replace(
queryParameters: Map.from(url.queryParameters)..addAll(parameters));
String basicAuthHeader(String identifier, String secret) {
var userPass = '${Uri.encodeFull(identifier)}:${Uri.encodeFull(secret)}';
return 'Basic ${base64Encode(ascii.encode(userPass))}';
}