forked from zio/zio-http
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Continue refactoring Middleware (zio#1642)
* Add handle method in MiddlwareSpec * Add toServiceSpec in API and handle method in Middleware trying out the spec usage * Fix formatting and compilation * Fix compile error * Rename to implement for middlewarespec * Fix compile errors in examples * Fix compile time errors in example * Try to implement toServiceSpec * Implement combine * More changes to Middleware * Fix compile time errors for status * Reformat core * Format benchmarks * Fix incoming of middleware * Fix the need of asInstanceOf * Fix peekrequest * Make sure toHttpMiddleware works
- Loading branch information
Showing
19 changed files
with
364 additions
and
160 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
package zio.http.api | ||
|
||
sealed trait CodecType | ||
|
||
object CodecType { | ||
type RequestType <: Route with Body with Query with Header with Method | ||
type ResponseType <: Body with Header with Status | ||
|
||
type Route <: CodecType | ||
type Body <: CodecType | ||
type Query <: CodecType | ||
type Header <: CodecType | ||
type Method <: CodecType | ||
type Status <: CodecType | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package zio.http.api | ||
|
||
object MethodCodec extends MethodCodecs |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package zio.http.api | ||
|
||
import zio.http.api.CodecType.Method | ||
|
||
private[api] trait MethodCodecs { | ||
def method(method: zio.http.model.Method): HttpCodec[CodecType.Method, Unit] = | ||
HttpCodec.Method(TextCodec.constant(method.toString())) | ||
|
||
def get: HttpCodec[Method, Unit] = method(zio.http.model.Method.GET) | ||
def put: HttpCodec[Method, Unit] = method(zio.http.model.Method.PUT) | ||
def post: HttpCodec[Method, Unit] = method(zio.http.model.Method.POST) | ||
def delete: HttpCodec[Method, Unit] = method(zio.http.model.Method.DELETE) | ||
|
||
} |
Oops, something went wrong.