File tree 3 files changed +10
-8
lines changed
main/java/groovyx/net/http
test/groovy/groovyx/net/http
3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 1
1
target /
2
+ * .iml
3
+ .idea /
Original file line number Diff line number Diff line change @@ -361,9 +361,11 @@ public void setDefaultParser( Closure defaultParser ) {
361
361
* @param contentType
362
362
* @return parser that can interpret the given response content type,
363
363
* or the default parser if no parser is registered for the given
364
- * content-type. It should NOT return a null value.
364
+ * content-type.
365
365
*/
366
366
public Closure getAt ( Object contentType ) {
367
+ if ( contentType == null ) return defaultParser ;
368
+
367
369
String ct = contentType .toString ();
368
370
int idx = ct .indexOf ( ';' );
369
371
if ( idx > 0 ) ct = ct .substring ( 0 , idx );
Original file line number Diff line number Diff line change @@ -2,17 +2,10 @@ package groovyx.net.http
2
2
3
3
import org.junit.Ignore
4
4
import org.junit.Test
5
- import java.lang.AssertionError
6
- import java.io.Reader
7
- import java.io.StringReader ;
8
5
9
- import groovy.util.XmlSlurper
10
- import groovy.util.slurpersupport.GPathResult
11
6
import org.apache.http.client.HttpResponseException
12
- import java.io.ByteArrayOutputStream
13
7
import static groovyx.net.http.ContentType.*
14
8
import static groovyx.net.http.Method.*
15
- import org.apache.xml.resolver.tools.CatalogResolver
16
9
17
10
class HttpURLClientTest {
18
11
@@ -237,4 +230,9 @@ class HttpURLClientTest {
237
230
}
238
231
catch ( IllegalArgumentException ex ) { /* Expected exception */ }
239
232
}
233
+
234
+ @Test (expected = SocketTimeoutException )
235
+ void testTimeout () {
236
+ new HttpURLClient (url : ' https://www.google.com/' ). request(timeout : 1 )
237
+ }
240
238
}
You can’t perform that action at this time.
0 commit comments