Skip to content

Commit

Permalink
Doc update for body parser/serializer changes
Browse files Browse the repository at this point in the history
This updates the names of the roles, which are now in Cro::Core.
  • Loading branch information
jnthn committed Feb 1, 2018
1 parent 30f4af4 commit d8a1657
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/reference/cro-http-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ my %panda = name => 'Bao Bao', eats => 'bamboo';
my $resp = await $client.post: 'we.love.pand.as/pandas', body => %panda;
```

The `Cro::HTTP::Client` class uses a `Cro::HTTP::BodySerializer` in order to
The `Cro::HTTP::Client` class uses a `Cro::BodySerializer` in order to
serialize request bodies for sending. Besides JSON, there are body parsers
encoding and sending a `Str`:

Expand Down
18 changes: 9 additions & 9 deletions docs/reference/cro-http-message.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ the result may not be meaningful).

#### As an object

Implementations of the `Cro::HTTP::BodyParser` role are used to parse a HTTP
message body into an appropriate object. Examples of what a body parser might
do include:
Implementations of the `Cro::BodyParser` role are used to parse a HTTP message
body into an appropriate object. Examples of what a body parser might do
include:

* Parsing the `application/x-www-form-urlencoded` and `multipart/form-data`
request bodies, most typically used by browsers to transmit form data
Expand All @@ -153,10 +153,10 @@ do include:
Cro provides a number of body parsers, which it enables by default. They can
also be provided externally.

A `Cro::HTTP::Message` has a `Cro::HTTP::BodyParserSelector`, which picks
the appropriate `Cro::HTTP::BodyParser` implementation to use. This may be
changed at any point before `body` is called. Body parser selectors can come
from a range of places:
A `Cro::HTTP::Message` has a `Cro::BodyParserSelector`, which picks the
appropriate `Cro::BodyParser` implementation to use. This may be changed at
any point before `body` is called. Body parser selectors can come from a
range of places:

* The `Cro::HTTP::ResponseParser` and `Cro::HTTP::RequestParser` objects
have a default set of body parsers. They may be constructed with extra body
Expand Down Expand Up @@ -193,8 +193,8 @@ The final 3 body parsers are in the default set for parsing responses:
The `set-body` method can be used to set the body. The `Cro::HTTP::Message`
will typically then reach either a `Cro::HTTP::ResponseSerializer` (servers)
or `Cro::HTTP::RequestSerializer` (clients), which call `body-byte-stream`. At
this point, an instance of `Cro::HTTP::BodySerializerSelector` will be used to
pick a `Cro::HTTP::BodySerializer` to use. Applications can change the selector
this point, an instance of `Cro::BodySerializerSelector` will be used to
pick a `Cro::BodySerializer` to use. Applications can change the selector
in order to add extra body serializers at any point before the message is
serialized to be sent over the network.

Expand Down
4 changes: 2 additions & 2 deletions docs/reference/cro-http-router.md
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,8 @@ argument.

## Adding custom response body serializers

Custom body serializers implement the `Cro::HTTP::BodySerializer` role. They
can decide when they are applicable by considering the type of the body and/or
Custom body serializers implement the `Cro::BodySerializer` role. They can
decide when they are applicable by considering the type of the body and/or
the response headers (most typically the `content-type` header).

Body serializers can be applied when configuring `Cro::HTTP::Server`, in which
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/cro-http-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ and private key respectively, should be passed.

## Request body parsers and response body serializers

Additional request body parsers (implementations of `Cro::HTTP::BodyParser`)
and response body serializers (implementations of `Cro::HTTP::BodySerializer`)
Additional request body parsers (implementations of `Cro::BodyParser`)
and response body serializers (implementations of `Cro::BodySerializer`)
can be added at the server level. Alternatively, the set of default set of
body parsers and serializers can be replaced entirely.

Expand Down

0 comments on commit d8a1657

Please sign in to comment.