[OLINGO-447] Also accept the * accept header

This commit is contained in:
Christian Amend 2014-09-30 17:22:36 +02:00
parent bd4ad859a6
commit 34825ab062
3 changed files with 30 additions and 12 deletions

View File

@ -18,17 +18,19 @@
*/ */
package org.apache.olingo.fit.tecsvc.http; package org.apache.olingo.fit.tecsvc.http;
import org.apache.olingo.commons.api.format.ContentType; import static org.junit.Assert.assertEquals;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.fit.tecsvc.TecSvcConst;
import org.junit.Test;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import static org.junit.Assert.assertEquals; import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.tecsvc.TecSvcConst;
import org.junit.Test;
public class BasicHttpITCase { public class BasicHttpITCase extends AbstractBaseTestITCase{
private static final String SERVICE_URI = TecSvcConst.BASE_URI + "/"; private static final String SERVICE_URI = TecSvcConst.BASE_URI + "/";
@ -114,6 +116,12 @@ public class BasicHttpITCase {
assertEquals("4.0", v); assertEquals("4.0", v);
} }
@Override
protected CommonODataClient<?> getClient() {
// TODO Auto-generated method stub
return null;
}
} }

View File

@ -18,6 +18,8 @@
*/ */
package org.apache.olingo.fit.tecsvc.http; package org.apache.olingo.fit.tecsvc.http;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.tecsvc.TecSvcConst; import org.apache.olingo.fit.tecsvc.TecSvcConst;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -28,7 +30,7 @@ import java.net.URL;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
public class PingITCase { public class PingITCase extends AbstractBaseTestITCase{
private static final Logger LOG = LoggerFactory.getLogger(PingITCase.class); private static final Logger LOG = LoggerFactory.getLogger(PingITCase.class);
@ -64,4 +66,9 @@ public class PingITCase {
assertEquals(200, code); assertEquals(200, code);
} }
@Override
protected CommonODataClient<?> getClient() {
return null;
}
} }

View File

@ -112,6 +112,9 @@ public class AcceptType {
typeSubtype.add(tokens[0]); typeSubtype.add(tokens[0]);
typeSubtype.add(tokens[1]); typeSubtype.add(tokens[1]);
} }
} else if (tokens.length == 1 && "*".equals(tokens[0])) {
typeSubtype.add(tokens[0]);
typeSubtype.add(tokens[0]);
} else { } else {
throw new IllegalArgumentException("Not exactly one '" + TypeUtil.TYPE_SUBTYPE_SEPARATOR + throw new IllegalArgumentException("Not exactly one '" + TypeUtil.TYPE_SUBTYPE_SEPARATOR +
"' in format '" + format + "', or it is at the beginning or at the end."); "' in format '" + format + "', or it is at the beginning or at the end.");