Skip to content

Commit

Permalink
Release: version 3.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Nassar Stoertz and Nathan Shayefar committed Oct 22, 2014
1 parent d98c2b8 commit 29c1b8f
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## Version 3.2.1 (October 21, 2014)
- ** Bug Fix ** Fixes a bug in processing certain HTTP headers for Native Ads.

## Version 3.2.0 (October 17, 2014)

- **Updated SDK License** Visit [http://www.mopub.com/legal/sdk-license-agreement/](http://www.mopub.com/legal/sdk-license-agreement/) for details.
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ Integration instructions are available on the [wiki](https://github.com/mopub/mo

Please view the [changelog](https://github.com/mopub/mopub-android-sdk/blob/master/CHANGELOG.md) for details.

- **Updated SDK License**

- **Bug Fixes**

## Requirements
Expand Down
2 changes: 1 addition & 1 deletion mopub-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android {

defaultConfig {
versionCode 1
versionName "3.2.0"
versionName "3.2.1"
minSdkVersion 9
targetSdkVersion 19
}
Expand Down
2 changes: 1 addition & 1 deletion mopub-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ android {

defaultConfig {
versionCode 1
versionName "3.2.0"
versionName "3.2.1"
minSdkVersion 9
targetSdkVersion 19
consumerProguardFiles 'proguard.txt'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public long getContentLength() {

public String getFirstHeader(final ResponseHeader responseHeader) {
for (final Header header : mHeaders) {
if (header.getName().equals(responseHeader.getKey())) {
if (header.getName().equalsIgnoreCase(responseHeader.getKey())) {
return header.getValue();
}
}
Expand Down
2 changes: 1 addition & 1 deletion mopub-sdk/src/main/java/com/mopub/common/MoPub.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.mopub.common;

public class MoPub {
public static final String SDK_VERSION = "3.2.0";
public static final String SDK_VERSION = "3.2.1";

public static enum LocationAwareness { NORMAL, TRUNCATED, DISABLED }

Expand Down
54 changes: 54 additions & 0 deletions mopub-sdk/src/test/java/com/mopub/common/DownloadResponseTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.mopub.common;

import com.mopub.common.test.support.SdkTestRunner;
import com.mopub.common.util.ResponseHeader;
import com.mopub.mobileads.test.support.TestHttpResponseWithHeaders;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.Locale;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

@RunWith(SdkTestRunner.class)
public class DownloadResponseTest {

DownloadResponse subject;
TestHttpResponseWithHeaders mockHttpResponse;

@Before
public void setup() throws Exception {
mockHttpResponse = new TestHttpResponseWithHeaders(200, "abcde".getBytes());
mockHttpResponse.addHeader(ResponseHeader.CUSTOM_EVENT_NAME.getKey(), "testCustomEvent");
mockHttpResponse.addHeader(ResponseHeader.CLICKTHROUGH_URL.getKey().toLowerCase(Locale.US), "http://example.com/");
mockHttpResponse.addHeader(ResponseHeader.FAIL_URL.getKey().toUpperCase(Locale.US), "http://mopub.com/");
subject = new DownloadResponse(mockHttpResponse);
}

@Test
public void testGetByteArray() throws Exception {
assertArrayEquals("abcde".getBytes(), subject.getByteArray());
}

@Test
public void testGetStatusCode() throws Exception {
assertEquals(200, subject.getStatusCode());
}

@Test
public void testGetContentLength() throws Exception {
assertEquals("abcde".getBytes().length, subject.getContentLength());
}

@Test
public void testGetFirstHeader_caseInsensitive() throws Exception {
assertEquals("testCustomEvent", subject.getFirstHeader(ResponseHeader.CUSTOM_EVENT_NAME));
assertEquals("http://example.com/", subject.getFirstHeader(ResponseHeader.CLICKTHROUGH_URL));
assertEquals("http://mopub.com/", subject.getFirstHeader(ResponseHeader.FAIL_URL));
assertNull(subject.getFirstHeader(ResponseHeader.CUSTOM_EVENT_DATA));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ public TestHttpResponseWithHeaders(int statusCode, String responseBody) {
headers = new HashMap<String, Header>();
}

public TestHttpResponseWithHeaders(int statusCode, byte[] responseBody) {
super(statusCode, responseBody);
headers = new HashMap<String, Header>();
}

@Override
public void addHeader(String name, String value) {
headers.put(name, new BasicHeader(name, value));
Expand Down

0 comments on commit 29c1b8f

Please sign in to comment.