> +/**
> + * Parses job status from http response
> + */
> +@Singleton
> +public class URIParser implements Function<HttpResponse, URI> {
> + public URI apply(final HttpResponse from) {
> + final String statusCode = Integer.toString(from.getStatusCode());
> + if (statusCode != null && statusCode.equals("202") &&
> from.getHeaders().containsKey("Location")){
> + String uri = from.getFirstHeaderOrNull("Location");
> + return URI.create(uri);
> + } else if (statusCode != null && statusCode.equals("200")){
> + return null;
> + }
> + throw new IllegalStateException("did not receive expected response
> code and header in: " + from);
> + }
> +}
And one final comment, we should add a unit tests for this class too.
---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/250/files/8d7d68bf33361d7f5df68c7e7232b03116ed6977#r58625565