Last active
August 16, 2016 13:54
-
-
Save fiunchinho/7ff3dcda089ffbe19d42359a92396650 to your computer and use it in GitHub Desktop.
Endpoint that returns 400 Bad requests when coming from Zuul
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequestMapping(value = "/endpoint", method = RequestMethod.PUT, produces = "application/json") | |
public Single<String> sayHello(HttpServletResponse response) throws IOException { | |
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("payload_big.json"); | |
Observable<String> sobs = Observable.create(new Observable.OnSubscribe<String>() { | |
@Override | |
public void call(Subscriber<? super String> subscriber) { | |
try { | |
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); | |
String line; | |
while((line= br.readLine())!=null) { | |
subscriber.onNext(line); | |
} | |
} catch (Exception e) { | |
subscriber.onError(e.getCause()); | |
} finally { | |
subscriber.onCompleted(); | |
} | |
} | |
}); | |
return sobs.first().toSingle(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment