fixes #955 adding client recipe to cookbook#962
Conversation
Codecov Report
@@ Coverage Diff @@
## master #962 +/- ##
=========================================
- Coverage 83.31% 82.7% -0.61%
=========================================
Files 50 50
Lines 827 827
Branches 49 48 -1
=========================================
- Hits 689 684 -5
- Misses 138 143 +5
Continue to review full report at Codecov.
|
|
|
||
| val host = "api.nasa.gov" | ||
| val client: Service[Request, Response] = Http.client.withTls(host).newService(s"$host:443") | ||
| val request = Request(Method.Get, "/planetary/apod?api_key=NNKOjkoul8n1CH18TWA9gwngW1s1SmjESPjNoUFo") |
There was a problem hiding this comment.
While I like using NASA for the example, I'm a little concerned about having this api key here for a couple reasons. Is this key always going to be valid? Whose is it? Are there rate limits applied to it? We may want to consider using something a little more stable.
There was a problem hiding this comment.
Can we use DEMO_KEY instead? This https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY works for me. They have some limits about the DEMO_KEY usage but I think we should be good: https://api.nasa.gov/api.html#demo_key-rate-limits
| val response: Future[Response] = client(request) | ||
|
|
||
| Await.result(response.onSuccess { rep: Response => | ||
| //println("GET success: " + rep.contentString) |
There was a problem hiding this comment.
We might want to remove this commented out line.
|
@erikwj Thanks for putting this together! I left a couple comments. Curious to hear your thoughts. |
| val corsService: Service[Request, Response] = new Cors.HttpFilter(policy).andThen(service) | ||
| ``` | ||
|
|
||
| ### Creating a Finagle Client |
There was a problem hiding this comment.
Can you also add a TOC item for this? I don't think we generate automatically.
vkostyukov
left a comment
There was a problem hiding this comment.
Thanks again, @erikwj! This looks good to me.
No description provided.