Author: fschumacher
Date: Sun Jan 29 10:19:27 2017
New Revision: 1780779
URL: http://svn.apache.org/viewvc?rev=1780779&view=rev
Log:
Followup to r1776794.
Re-Add "Basic " to the authorization header.
Added:
jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestAuthorization.java
(with props)
Modified:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/Authorization.java
Modified:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/Authorization.java
URL:
http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/Authorization.java?rev=1780779&r1=1780778&r2=1780779&view=diff
==============================================================================
---
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/Authorization.java
(original)
+++
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/Authorization.java
Sun Jan 29 10:19:27 2017
@@ -132,7 +132,7 @@ public class Authorization extends Abstr
}
public String toBasicHeader(){
- return new String(Base64.getEncoder().encode((getUser() + ":" +
getPass()).
+ return "Basic " + new String(Base64.getEncoder().encode((getUser() +
":" + getPass()).
getBytes(Charset.defaultCharset())), Charset.defaultCharset());
}
}
Added:
jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestAuthorization.java
URL:
http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestAuthorization.java?rev=1780779&view=auto
==============================================================================
---
jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestAuthorization.java
(added)
+++
jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestAuthorization.java
Sun Jan 29 10:19:27 2017
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jmeter.protocol.http.control;
+
+import static org.junit.Assert.*;
+
+import org.apache.jmeter.protocol.http.control.AuthManager.Mechanism;
+import org.hamcrest.CoreMatchers;
+import org.junit.Test;
+
+public class TestAuthorization {
+
+ @Test
+ public void testToBasicHeader() {
+ Authorization basicAuthorization = new
Authorization("http://example.com", "foo", "bar", null, "Test Realm",
+ Mechanism.BASIC_DIGEST);
+ assertThat(basicAuthorization.toBasicHeader(), CoreMatchers.is("Basic
Zm9vOmJhcg=="));
+ }
+
+}
Propchange:
jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestAuthorization.java
------------------------------------------------------------------------------
svn:eol-style = native