akka / akka-http

The Streaming-first HTTP server/module of Akka
https://doc.akka.io/docs/akka-http
Other
1.34k stars 596 forks source link

DOCS: make sure to document needed implicits #278

Open akka-ci opened 7 years ago

akka-ci commented 7 years ago

Issue by rkuhn Friday Jul 17, 2015 at 07:13 GMT Originally opened as https://github.com/akka/akka/issues/18021


From the mailing list:

I got hit by this stuff today when moving some tests from one package to another disabled responseAs[String] completely (earlier, it worked in some endpoints, but not in others). The answer is to import akka.http.scaladsl.unmarshalling.Unmarshaller. in tests, which mixes in PredefinedFromEntityUnmarshallers, which contain an unmarshaller to string. Second, it is necessary to import akka.http.scaladsl.marshalling.Marshaller. in the file where the route is defined, so that string responses are marshalled correctly (if you don't do it, your response bodies unmarshalled in tests will contain an extra set of double quotes).

akka-ci commented 7 years ago

Comment by drewhk Tuesday Aug 25, 2015 at 12:48 GMT


Maybe add one dedicated section too, kind of an "imports cheat-sheet"? I also have to sometimes look into the akka-http tests to remember what imports I will need and which I don't, implicits or simply model entities :)

akka-ci commented 7 years ago

Comment by patriknw Tuesday Aug 25, 2015 at 16:31 GMT


+1

raboof commented 6 years ago

We're moving in the direction of making all code snippets more self-contained, so showing all relevant imports, including those pulling in implicits.

(we should also make sure the relevant implicitnotfound annotations are in place, see #2064)