Skip to content

Commit

Permalink
Update Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
vkostyukov committed Jul 29, 2014
1 parent 567bc78 commit c1da6c2
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,18 @@ val a = JsonArray(JsonObject.empty, JsonObject.empty)
val aa = aa.within { _.take(5).distinct }
```

**Converting JSON into HTTP**
There is a magic service `io.finch.json.TurnJsonIntoHttp` that takes `JsonResponse` and converts it into an `HttpResponse`.

```scala
import io.finch.json._

val a: Service[HttpRequest, JsonResponse] = ???
val b: Service[HttpRequest, HttpResponse] = a ! TurnJsonIntoHttp
```

This also may be used with `Endpoint`.

Authorization with OAuth2
-------------------------

Expand All @@ -427,15 +439,14 @@ Basic HTTP Auth
---------------

[Basic HTTP Auth](http://en.wikipedia.org/wiki/Basic_access_authentication) is supported out-of-the-box and implemented
as `finch.io.filter.BasicallyAuthorize` filter.
as `finch.io.auth.BasicallyAuthorize` filter.

```scala
object ProtectedEndpoint extends Endpoint[HttpRequest, HttpResponse] {
def route = {
case Method.Get -> Root / "users" => BasicallyAuthorize("user", "password") ! GetUsers
}
}

```

Licensing
Expand Down

0 comments on commit c1da6c2

Please sign in to comment.