-
Notifications
You must be signed in to change notification settings - Fork 412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Echo HttpData
directly from Request
#1244
Conversation
3e109cb
to
f482211
Compare
Codecov Report
@@ Coverage Diff @@
## main #1244 +/- ##
==========================================
- Coverage 58.87% 58.79% -0.09%
==========================================
Files 74 74
Lines 2480 2480
Branches 66 63 -3
==========================================
- Hits 1460 1458 -2
- Misses 1020 1022 +2
Continue to review full report at Codecov.
|
HttpData
directly from Request
f482211
to
dccb83c
Compare
def read(): Unit = ctx.read(): Unit | ||
} | ||
|
||
private[zhttp] final case class UnsafeAsync(unsafeRun: (UnsafeChannel => UnsafeContent => Unit) => Unit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing unnecessary wrapping from HttpContent and ChannelHandlerContext. Since we are being explicit about it being an "unsafe" API, the wrapping seems a bit unnecessary.
HTTP_REQUEST_HANDLER, | ||
HTTP_CONTENT_HANDLER, | ||
new RequestBodyHandler(callback(ctx)), | ||
): Unit, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initializing the callback here to avoid race conditions inside of RequestBodyHandler
unsafeRun { _ => msg => | ||
ctx.writeAndFlush(msg) | ||
if (!msg.isInstanceOf[LastHttpContent]) ctx.read(): Unit | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will allow responses to use the HttpData received in the request directly. This is also going significantly more performant than echo using streams.
* Doc: Add outline (#815) * doc: add categories * refactor: doc structure refactored * fix: package-lock.json removed * refactor: create outline sub-directories * refactor: rename test to testing * Update netty-all to 4.1.73.Final (#811) * Disable benchmarks comment on fork pull request (#820) * Disable benchmarks on fork PR * run benchmarks on fork PR but disbable PR comment * Feature: API to modify headers (#824) * feat(Headers):added new api to update headers * renamed api * Feature: Signed Cookie (#751) * feat(cookie): added secret in cookie * feat(cookie): added signcookie middleware * feat(cookie): scalafmt * fix(cookie): sign cookie while encoding * scalafmt * fix(Cookie): added unsign method for cookie * fix(cookie): minor changes * fix(signCookieMiddleware: simplified signCookies * fix(cookie): removed try catch from signContent * cookie: throw error in verify * cookie: throw error in verify * verify method changes * fixed test cases * fix: removed decodeResponseSignedCookie * fix: middlewareSpec * added modifyheaders in middleware * removed unwanted changes * scalafmt * refactoring * refactoring * build fix * build fix * fix: decodeResponseCookie * added modify * Update sbt-scalafix to 0.9.34 (#805) * Fix: Echo streaming (#828) * Failing test * Fix echo streaming * Pr Comments * Docs: Update Basic Examples (#814) * doc(Getting started): updated examples * docs: updated basic examples * docs: update advanced examples (#816) * maintenance: semanticdb revision usage (#832) * maintenance: workflow scala version (#833) * Fix: HasHeader bug (#835) * #834 - fix and test for the bug. * applied suggested change * refactor: fix naming for Http operators (#839) * Update sbt-bloop to 1.4.12 (#810) * Update sbt-bloop to 1.4.12 * Update sbt-bloop to 1.4.12 * Update scala-library to 2.13.8 (#801) * Update scala-library to 2.13.8 * Regenerate workflow with sbt-github-actions * Add configuration builder methods to zhttp.service.Server (#768) * Add configuration builder methods to zhttp.service.Server * Update zio-http/src/main/scala/zhttp/service/Server.scala Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Update zio-http/src/main/scala/zhttp/service/Server.scala Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Update zio-http/src/main/scala/zhttp/service/Server.scala Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Change some server with* builder methods (enable parameter) * Server withAcceptContinue(enabled) Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * maintenance: html template for internal server error string (#851) Closes #842 * Performance: Improve benchmarking code (#731) * wip: try server codec without validation * wip: remove flush consolidator * wip: use wrapped buffer * wip: add flush consolidator * perf: make response encoding checks faster * use encoder and decoder (#733) * wip: remove Request creation * use encoder and decoder Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * disable object aggregator * disable object aggregator * revert disable object aggregator * doc: update scala doc * perf: freeze the HttpResponse Co-authored-by: Amit Kumar Singh <amit.singh@dream11.com> Co-authored-by: amitsingh <amitksingh1490@gmail.com> * Refactor: Support middlewares on Http (#773) * refactor: remove type-params from Response * chore: self review * refactor: rename Middleware to HttpMiddleware * refactor: add `@@@` to Http as an alternative to `@@`. * feature: add new Middleware API * feature: add `flatten` and `ifThenElse` * feature: add `ifThenElseZIO` * refactor: fix type params for `identity` * feature: add `when` * feature: add `make` constructor * refactor: make middleware methods final * refactor: git remains * refactor: implement HttpMiddleware as Middleware * scala3 fix * Refactor CORS middleware (#788) * Refactor/merge middleware and http middleware (#790) * Refactor move cors and timeout * move some httpMiddlewares to Middleware * move some AuthMiddleware to Middleware * move remaining AuthMiddleware to Middleware * move Middlewares to middleware package * scaladoc * codec example * move Middleware to http package * named alias for `@@` * rename Auth to AuthMiddlewares * rename CORSMiddleware to CorsMiddlewares * rename CSRF to CsrfMiddlewares * make primitives private * rename MiddlewareExtensions to HttpMiddlewares * rename operators in HttpMiddlewares * scalaDoc * arg rename * doc update and general refactor * simplify cors middleware * rename CorsConfig * renames * Make middlewares package private MiddlewareRequest * Introduce MiddlewareRequest (#798) * Introduce MiddlewareRequest * PR review comments * Refactor move runAfter to Middleware * refactor: add `UMiddleware` * feature: add `contramapZIO` * refactor: move cors config to Cors file * refactor: rename files * refactor: remove AuthSpec from WebSpec * refactor: fix naming for Http operators * refactor: add partial type suport for contraMapZIO * Refactor: Codec (#841) * Add Run Before (#840) * Add Run Before * Add Run Before and After * use renamed operator * refactor: add partial type suport for contraMap * Implement missing operators in Middleware (#807) * Implement missing operators in Middleware * fix as operator * headers Middleware changes * sign cookie * extend with HeaderExtensions * rename suite * PR comments * refactor: use `Request` instead of `MiddlewareRequest` * refactor: rename methods * refactor: resolve fix me issue Co-authored-by: amitsingh <amitksingh1490@gmail.com> Co-authored-by: Amit Kumar Singh <amit.singh@dream11.com> * refactor: rename ClientParams to ClientRequest (#856) * refactor: use declarative encoding for http.middleware (#869) * Move docs to v1.x directory (#861) * Bug Add host in client from absolute URL (#847) * feat(Client): Add host in client from absolute URL * feat(Client): Refactor and add spec for host value * feat(Client): fmt formatting * feat(Client): fmt formatting * feat(Client): use setHeaders from netty * feat(Client): Add spec for host * feat(Client): Add spec for host * feat(Client): Rename clientParams to clientRequest * Doc website fix (#871) * Update scala3-library to 3.1.1 (#873) * Update scala3-library to 3.1.1 * Regenerate workflow with sbt-github-actions * Doc: Fix getting started link (#874) * Update scalafmt-core to 3.3.2 (#864) * Doc: `Headers` documentation (#817) * doc: add categories * refactor: doc structure refactored * fix: package-lock.json removed * refactor: create outline sub-directories * initial draft on Headers documentaiton * refactor: rename test to testing * migrated Headers doc in the right structure * re-organized the section. added more examples on the service, client and middleware side. * updated documentation * updated based on review * more updates * more updates * minor changes * minor changes * Update docs/website/docs/v1.x/dsl/headers/index.md * Update docs/website/docs/v1.x/dsl/headers/index.md Co-authored-by: Shubham Girdhar <girdharshubham@hotmail.com> Co-authored-by: amitsingh <amitksingh1490@gmail.com> Co-authored-by: Amit Kumar Singh <amit.singh@dream11.com> * Fix collapsible Headers Doc (#876) * Test: Added Integration tests for `HExit.Success` (#852) * feat: added validation app for HExit without zio * feat: removed type from validationAppSpec * test: Iterating using HttpGen.Method * test: rearranged status method params * test: name fixes * Update scalafmt-core to 3.3.3 (#881) * Update scalafmt-core to 3.3.3 (#884) * Fix: EncodeClientParams (#868) * fix: encodeClientParams * test(client): added test for req url string * test(client): variable name changed * test: added test in encodeClientSpec * simplifies test case * doc: add comment on why relative path needs to be used. Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Refactor: HttpRunnableSpec clean up (#857) * refactor: reduce HttpRunnableSpec boilerplate * refactor: remove all helpers from HttpRunnableSpec and inline the method * doc: update documentation for test module * refactor: add type-constraints to Http for specialized methods * refactor: use IsResponse type constraint * style(*): apply scala fmt * doc: update documentation * update doc (#897) * Docs: Getting started (#887) * fix: added more content * fixed comments * fix: getting started * modifications * added more * minor changes * minor changes * changes * refactor: rename asString to encode in URI (#898) * refactor: rename asString to encode in Scheme (#904) * fix: example links (#906) * Update getting-started.md (#907) * refactor: rename asString to encode in Scheme (#905) * Doc: setup (#886) * doc: setup * resolve: PR comments * Update netty-incubator-transport-native-io_uring to 0.0.12.Final (#908) * Documentation for Server (#885) * removed config.md and make configurations part of Server page * added server configurations * markdwon appearing fine in docusaurus generated page * added one missing configuration * Server documentation changed according to PR comments * change note to tip Co-authored-by: Sumant Awasthi <sumant.awasthi@D11-Sumant.Awasthi> Co-authored-by: amitsingh <amitksingh1490@gmail.com> * Performance: Improve performance of `collectM` (#882) * Use ZIO response * fix: improve cancellation performance * refactor: use sticky server * refactor: reduce allocations * revert example * Doc: Added <> operator in getting started (#910) * fix: ++ operator doc * fix: composition * feature: Add `collectManaged` to Http (#909) * Add collectManaged * comment typo * feature: add `echo` operator to `Socket` (#900) * feature: add `Socket.empty` (#901) * feature: add `Socket.empty` * test: add unit test case for Socket#empty Co-authored-by: Shubham Girdhar <girdharshubham@hotmail.com> * feature: add `toHttp` to Socket.scala (#902) * feature: add `toHttp` to Socket.scala * test: add unit test for `toApp` to Socket.scala Co-authored-by: Shubham Girdhar <girdharshubham@hotmail.com> * refactor: merge Request for Client and Server (#894) * Revert "refactor: merge Request for Client and Server (#894)" (#915) This reverts commit fc8b9b5a155e7c59b548d191265d30e0e6b61d8b. * Feature: add `toHttp` to Response (#903) * feature: add `wrapHttp` to Response * test: add unit test for wrapHttp in Response.scala * refactor: operator name changed to `toHttp` Co-authored-by: Shubham Girdhar <girdharshubham@hotmail.com> * Update scalafmt-core to 3.4.0 (#920) * Update sbt to 1.6.2 (#931) * Remove outdated benchmark.md (#940) * removed benchmark file * removed benchmark hyperlink from readme * refactor: rename `getHeaders` to `headers` in `ClientRequest` (#928) * refactor: rename `getHeaders` to `headers` in `ClientRequest` * fix: compiler errors * fix: compiler errors * Refactor: rename `asString` to `encode` in `Path` (#927) * refactor: rename `asString` to `encode` in Path * fix: compiler errors * Disable flow Control (#854) * Add builder pattern for URL (#930) * Add builder pattern for URL * Compare encoded value to string literal * Documentation: Http (#888) * initial commit for http documentation * refactor: adding bold formatting for HTTP and resolving review comments * refactor: Chnage app to application in http documentation * refactor:fixed review comments * added combinators section * style: formatting the code blocks * added getBodyAsString to http documentation * added HttpApp section * fixing typos * added mapZIO and contamapZIO documentation for http * provide layer documentation for http * doc: added a secion- Running an HttpApp Co-authored-by: Dino John <dinojohn@D11-Dino.John> * feature: add `Http.apply` (#949) * Refactor: Drop `toZIO` and `wrapZIO` APIs (#950) * feature: add `Http.apply` * refactor: remove ZIO wrapping APIs * Fix: Server KeepAlive true by default and enable client to set Http version on requests (#792) * IT cases for KeepAlive included in ServerConfigSpec * Allow possibility of modifying server conf in HttpRunnableSpec * reverted Header.scala * reverted Header.scala * reverted Header.scala * struggling with fmt * pull latest from main * reverting changes in ci files * included review recommendations * Concise test description * removed extra comments * readjusted ServerConfigSpec * enable keep alive by default; added more test cases for Http 1.0; tweaked test cases and description * removed configurableServe * removed unnecessary lines; shorter tests * reverted Server disabled and some spec changes * Test/keepalive httpversion (#800) * make httpVersion first param in request methods * tweaked test cases even further using requestHeaderValueByName * changed names * resolved comments, and more tweaking of test * deleted extra line Co-authored-by: Sumant Awasthi <sumant.awasthi@D11-Sumant.Awasthi> * Renamed ServerConfigSpec to KeepAliveSpec * made httpVersion first param in ClientParams, made relevant changes * in EncodeClientParams use http version from ClientParams * a minor change * changed server keepAlive = true by default, also rebased with main Co-authored-by: Sumant Awasthi <sumant.awasthi@D11-Sumant.Awasthi> * feat: url add `isAbsolute` and `isRelative` operators (#946) * refactor: add type-params * feat: url add `isAbsolute` and `isRelative` operators # Conflicts: # zio-http/src/main/scala/zhttp/http/URL.scala * WebSocket Client Support (#933) * wip: websocket client support * test: add unit test for WebSocket using native websocket client * fix: fromZIO in websocket client spec * refactor: queue usage simplified * feat: websocket client support * refactor: imports optimized * doc: for ClientSocketHandler * refactor: bootstrap method * websocket client with response support * feat: wss support * refactor: SocketProtocol * refactor: add SocketClient example: add WebSocketSimpleClient * refactor: SocketProtocol with type evidence refactor: general clean up * test: for Scheme * refactor: rename asString to encode in URI * refactor: remove example of SecureClient * refactor: url doesn't need to be part of the protocol. Url can be passed as an additional parameter for now. This simplifies the overall design. * refactor: socket client for now will take the complete url * refactor: update client example * refactor: add `connect` operator to SocketApp * refactor: use `url` as a string instead of URL type * refactor: re-order methods * style(*): apply scala fmt * revert: unnecessary changes * feature: add `echo` operator to `Socket` * refactor: update type info * feature: add `Socket.empty` * feature: add `wrapHttp` to Response * feature: add `toHttp` to Socket.scala * style(*): apply scala fmt * refactor: rename asString to encode in Scheme * refactor: cleanup Scheme changes * test: update test assertion * refactor: combine server and client handlers * refactor: add hint in touch for ClientSocketUpgradeHandler * refactor: change package for SocketAppHandler * refactor: rename methods in SocketProtocol * fix: add host header and port in Request automatically * fix: example links (#906) * Update getting-started.md (#907) * refactor: rename asString to encode in Scheme (#905) * Doc: setup (#886) * doc: setup * resolve: PR comments * Update netty-incubator-transport-native-io_uring to 0.0.12.Final (#908) * Documentation for Server (#885) * removed config.md and make configurations part of Server page * added server configurations * markdwon appearing fine in docusaurus generated page * added one missing configuration * Server documentation changed according to PR comments * change note to tip Co-authored-by: Sumant Awasthi <sumant.awasthi@D11-Sumant.Awasthi> Co-authored-by: amitsingh <amitksingh1490@gmail.com> * Performance: Improve performance of `collectM` (#882) * Use ZIO response * fix: improve cancellation performance * refactor: use sticky server * refactor: reduce allocations * revert example * Doc: Added <> operator in getting started (#910) * fix: ++ operator doc * fix: composition * feature: Add `collectManaged` to Http (#909) * Add collectManaged * comment typo * feature: add `echo` operator to `Socket` (#900) * feature: add `Socket.empty` (#901) * feature: add `Socket.empty` * test: add unit test case for Socket#empty Co-authored-by: Shubham Girdhar <girdharshubham@hotmail.com> * refactor: add attribute to Request created by Handler * refactor: remove "case" from ClientInboundHandler * refactor: rename to WebSocketAppHandler * feature: add `toHttp` to Socket.scala (#902) * feature: add `toHttp` to Socket.scala * test: add unit test for `toApp` to Socket.scala Co-authored-by: Shubham Girdhar <girdharshubham@hotmail.com> * cleaning up residue files * refactor: rename `asString` to `encode` in Path * refactor: rename `getHeaders` to `headers` in `ClientRequest` * refactor: simplify client API * refactor: update client params encoder * style: ordering methods in URL.scala * refactor: ClientRequest will throw if the url is invalid * refactor: pass URL instead of String in ClientRequest * test: fix `GetBodyAsStringSpec` * style(*): apply scala fmt * refactor: fix invalid url being passed in HttpRunnableSpec * refactor: Move SSL requirements to ClientAttirbute * feature: add `scheme` operator on URL * feature: add `IsWebSocket` and `isSecure` operators on Scheme * refactor: use named imports in WebSocketAppHandler * test: fix base url for websockets * refactor: update how flags are set inside client * test: add non-zio spec to the spec list * refactor: fix client test * style: scalafmt error and remove TODO * refactor: remove unused handler * refactor: remove host header changes and RequestSpec (#945) * refactor: move java scheme generators to SchemeSpec (#944) * refactor: move java scheme generators to SchemeSpec * refactor: resolve PR comments * feat: url add `isAbsolute` and `isRelative` operators * refactor: rename EncodeClientParams.scala to EncodeClientRequest * fix: handle errors on client connection * style(*): apply scala fmt * refactor: simplify multiple websocket upgrades test (#948) * refactor: resolve PR comments style: fmt fix * refactor: general refactor and style changes Co-authored-by: Shubham Girdhar <girdharshubham@hotmail.com> Co-authored-by: Shruti Verma <62893271+ShrutiVerma97@users.noreply.github.com> Co-authored-by: Amit Kumar Singh <amit.singh@dream11.com> Co-authored-by: Scala Steward <43047562+scala-steward@users.noreply.github.com> Co-authored-by: sumawa <awasthi.sumant@gmail.com> Co-authored-by: Sumant Awasthi <sumant.awasthi@D11-Sumant.Awasthi> Co-authored-by: amitsingh <amitksingh1490@gmail.com> Co-authored-by: James Beem <beem132@gmail.com> * Documentation: Request (#926) * docs: request * doc: added client request docs * added query param section * doc: refactoring * WIP * fix: doc * fix: doc * request * request * example fixed * Fix ssl issue due to missing peer host port hint (#952) * feature: add connect operator on Socket (#955) * Style: Update scala doc wrapping (#959) * chore: update scalafmt config * style(*): apply scala fmt * remove get prefix (#958) * Update scalafmt-core to 3.4.1 (#960) * Update scalafmt-core to 3.4.2 (#962) * Update scalafmt-core to 3.4.2 (#961) * remove declarative API (#957) * Update sbt-updates to 0.6.2 (#966) * Doc: Readme (#970) * fix: readme * changed note * style: rearrange methods in files (#963) * Doc: Cookie (#974) * doc: cookie * doc: cookie * cookie: changes * refactor: drop `CanBeSilent` type-constraint from Http (#964) * refactor: drop `CanBeSilent` type-constraint from Http * update usage of `silent` operator * Feature: add `Version` (#965) * refactor: rename `asHttpMethod` to `toJava` * refactor: add `Version` domain * style(*): apply scala fmt * Fix: Fire response instead of error in HExit.Failure() (#980) * Bug fix: fixes #979 * Made changes to nonZIOSpec in ServerSpec to include tests for HExit.Failure() * fix: typo in bug_report.md (#981) * Update netty-all to 4.1.74.Final (#982) * refactor: remove sealed modifier from Middleware trait (#984) * refactor: rename method on Client (#985) * fix: request doc (#989) * Use a Gen of methods without HEAD for Responses with content (#992) * doc: setup g8 (#988) * doc: setup g8 * refactor: bump zhttp version * Doc: for WebSocketFrame (#953) * doc: for WebSocketFrame * resolve: PR comments * resolve: PR comments * Documentation for HttpData (#987) * Documentation for HttpData * added server and client side usage of HttpData * Update docs/website/docs/v1.x/dsl/http-data/index.md Co-authored-by: Amit Kumar Singh <amit.singh@dream11.com> * refactor: rename `provide` and `provideSome` (#996) * Fix: `Content-Type` header gets incorrect values. (#899) * initial work * Fix tests * Perf enhancements * compilation error fix * rename getContentType * Update zio-http/src/main/scala/zhttp/http/MediaType.scala Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Make MediaType private, and final. Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Feat: Http from HExit (#986) * added 2 operators to create http from HExit * added tests for collectHExit and fromFunctionHExit * rewrote nonZIO app in serverSpec using collectHExit * Refactor: Remove Collect and FromFunctionZIO (#1002) * Refactor: Implemented FromFunctionZIO using FromFunctionHExit * Refactor: Implement Collect using FromFunctionHExit * Fix: Binary WebSocketFrame (#1005) * fix: change binary websocket frame arg to Chunk[Byte] from ByteBuf Closes #1004 * test: add unit test for binary websocketframe * style: fix formatting * feature: add `fromFileZIO` (#1010) * refactor: `fromFile` uses `fromFileZIO` * feature: add `Http.fromResource` (#1009) * Refactor: Content Type Fixes (#1008) * style: scalafmt fixes * style: sorting alphabetically * fix: set conten-type only if not set already * refactor: make internal fields private * doc: add todo * refactor: make caching optional * refactor: use `Http.fromResource` in test * refactor: fix test * doc: fix binary constructor usage (#1014) * Add data in `Request` trait (#1017) * maintenance: run scalafmt once (#1027) * Build(deps): Bump follow-redirects in /docs/website (#1029) Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.7 to 1.14.8. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.7...v1.14.8) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update scalafmt-core to 3.4.3 (#1022) * Remove tuple from ResponseHandler (#1033) * Remove tuple from ResponseHandler * cleanup * restructuring (#1040) * added more examples (#1038) * Doc: Response (#967) * updated with main * added operators * revert * setstatus change * renaming (#1047) * Fix: Releasing request twice (#1046) * refactor: not releasing request * Added failing test * optimize path encode method (#1035) * Feature: Static Server (#1024) * WIP : static server from file path * fix CI errrors * format * Basic functionalities work without options * Fix errors on java8 * Fix errors on java8 * Fix refactoring error * clean up * Fixig tests * working around file type detection bug * Method not allowed. * Better comments. * Update zio-http/src/main/scala/zhttp/http/Http.scala Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Refactor * More tests. * Fix PR comments * Moved headers to fromPath * Update zio-http/src/main/scala/zhttp/http/Http.scala Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Update zio-http/src/main/scala/zhttp/http/Http.scala Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Fixes. * Fixing tests * Update zio-http/src/main/scala/zhttp/http/HttpData.scala Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Update zio-http/src/main/scala/zhttp/http/HttpData.scala Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Update zio-http/src/main/scala/zhttp/http/Http.scala Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * PR is closed * Used Http.fromFile in implementation * Remove unwanted commits * Fixing compile issues. * feature: add `withMediaType` operator in HeaderModifier * refactor: drop `setMediaType` from Response * refactor: inline file creation * refactor: simplify implementation for fromFile and fromFileZIO * doc: add todo comments * refactor: update listFilesHtml implementation * refactor: update scaladoc * test: fix refactored misses * test: use `+` instead of `,` * style: scalafmt * feature: add `mediaType` to HeaderGetters * feature: add Http.attempt` operator * refactor: MediaType works on extensions directly * refactor: add tests for fromResource * test: StaticFileServerSpec add tests for directory * refactor: make `fromPath` use `fromFile` internally * refactor: simplify `fromPath` * refactor: update scala docs for Http operators * refactor: fix type info of `Http.response` * feature: add `listDirectory` operator * feature: add StyledContainerHtml * refactor: drop `Util` * refactor: inline util HTML constructors * test: add test for invalid file size * doc: update comments * style: reorder methods in Http Co-authored-by: ashprakasan <prakasanaiswarya@gmail.com> * Revert "Feature: Static Server (#1024)" (#1060) This reverts commit 33ac08d1a528143dfbcfcbee2d3202b31abbbd30. * Performance: Use `CharSequence` for ServerTime (#1064) * feature: use CharSequence in for ServerTime * style: scalafmt * Feature: add `dropLast` to Path (#1065) * feature: add `dropLast` to Path * style: scalafmt * feature: Response.html now supports taking in Status also (#1067) * feature: add `code` method on Status (#1068) * refactor: fix type info of `Http.response` (#1073) * feature: add `foldCause` to HttpError (#1066) * feature: add `withMediaType` operator in HeaderModifier (#1071) * Feature: add `Http.attempt` operator (#1070) * feature: add Http.attempt` operator * test: add tests for Http.attempt * feature: add `getResource` and `getResourceAsFile` operators on Http (#1074) * Update jwt-core to 9.0.4 (#1056) * Update sbt-bloop to 1.4.13 (#1055) * Build(deps): Bump url-parse from 1.5.4 to 1.5.7 in /docs/website (#1062) Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.5.4 to 1.5.7. - [Release notes](https://github.com/unshiftio/url-parse/releases) - [Commits](https://github.com/unshiftio/url-parse/compare/1.5.4...1.5.7) --- updated-dependencies: - dependency-name: url-parse dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * feature: add `ifModifiedSinceDecoded` (#1075) * Feature: Static Server (#1061) * WIP : static server from file path * fix CI errrors * format * Basic functionalities work without options * Fix errors on java8 * Fix errors on java8 * Fix refactoring error * clean up * Fixig tests * working around file type detection bug * Method not allowed. * Better comments. * Update zio-http/src/main/scala/zhttp/http/Http.scala Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Refactor * More tests. * Fix PR comments * Moved headers to fromPath * Update zio-http/src/main/scala/zhttp/http/Http.scala Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Update zio-http/src/main/scala/zhttp/http/Http.scala Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Fixes. * Fixing tests * Update zio-http/src/main/scala/zhttp/http/HttpData.scala Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Update zio-http/src/main/scala/zhttp/http/HttpData.scala Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Update zio-http/src/main/scala/zhttp/http/Http.scala Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * PR is closed * Used Http.fromFile in implementation * Remove unwanted commits * Fixing compile issues. * feature: add `withMediaType` operator in HeaderModifier * refactor: drop `setMediaType` from Response * refactor: inline file creation * refactor: simplify implementation for fromFile and fromFileZIO * doc: add todo comments * refactor: update listFilesHtml implementation * refactor: update scaladoc * test: fix refactored misses * test: use `+` instead of `,` * style: scalafmt * feature: add `mediaType` to HeaderGetters * feature: add Http.attempt` operator * refactor: MediaType works on extensions directly * refactor: add tests for fromResource * test: StaticFileServerSpec add tests for directory * refactor: make `fromPath` use `fromFile` internally * refactor: simplify `fromPath` * refactor: update scala docs for Http operators * refactor: fix type info of `Http.response` * feature: add `listDirectory` operator * feature: add StyledContainerHtml * refactor: drop `Util` * refactor: inline util HTML constructors * test: add test for invalid file size * doc: update comments * style: reorder methods in Http * refactor: improve style of StyledContainerHtml * refactor: drop directory support * refactor: drop directory listing * refactor: add a color to background * feature: add `getResource` and `getResourceAsFile` operators on Http * feature: add `foldCause` to HttpError * feature: add `code` method on Status * feature: StyleContainerHtml max-width updated * feature: Handler uses `HttpError` for empty responses * feature: Response.html now supports taking in Status also * feature: beautify Response.fromHttpError * refactor: rename file to Template * feature: add `dropLast` to Path * feature: add `Http.template` operator * example: update static server example * style: scalafmt updates * feature: use CharSequence in for ServerTime * feature: add `ifModifiedSinceDecoded` * feature: add `ifModifiedSinceDecoded` * feature: add `ifModifiedSinceDecoded` Co-authored-by: ashprakasan <prakasanaiswarya@gmail.com> * issue 715 Support custom ChannelInitializer (#932) * doc: socket (#1036) * doc: socket * refactor: clean up * refactor: resolve PR comment * fix: resolve PR comment and fix typo in `merge` * feat: added new constructor in http (#1077) * Feature: Add `when` operator in `Http` (#1078) * perf: added when operator in http * build fix * removed jrequest from constructor * fmt * unsafeEncode: HttpRequest * added when primitive * refactor: rename `whenPath` to `whenPathEq` Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Feature: Effectful Auth Middleware (#1079) * added effectful athu middlewares * added tests * refactor: stopped calling tuple of credentials as Header * added credentials * Test: Server Settings Support in `HttpRunnableSpec#serve` (#1053) * feat: server settings support in HttpRunnableSpec#serve * resolve: PR comments * refactor: website docs sidebar pages repositioned (#1049) * Feat: Server Request Decompression (#1095) * feat: server request decompression * test: add test for deflate * Feature: Added helper checkers to `Status` class (#1058) * Added helper checkers to Status class * For status, formatted, removed and made them def Co-authored-by: Roberto Leibman <rleibman@demandbase.com> * Build(deps): Bump prismjs from 1.26.0 to 1.27.0 in /docs/website (#1100) Bumps [prismjs](https://github.com/PrismJS/prism) from 1.26.0 to 1.27.0. - [Release notes](https://github.com/PrismJS/prism/releases) - [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md) - [Commits](https://github.com/PrismJS/prism/compare/v1.26.0...v1.27.0) --- updated-dependencies: - dependency-name: prismjs dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Build(deps): Bump url-parse from 1.5.7 to 1.5.10 in /docs/website (#1103) Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.5.7 to 1.5.10. - [Release notes](https://github.com/unshiftio/url-parse/releases) - [Commits](https://github.com/unshiftio/url-parse/compare/1.5.7...1.5.10) --- updated-dependencies: - dependency-name: url-parse dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * added try catch in handler to catch throwable apps (#1099) * removed flatten from test (#1109) * Feature: Request Streaming (#1048) * introduce `Incoming` and `Outgoing` inHttpData * streaming support * benchmark disable objectAggregator * cleanup * refactor * cleanup + PR comments * cleanup + PR comments * cleanup + PR comments * refactor: rename variable * memory leak * refactor: Handler now extends ChannelInboundHandlerAdapter * refactor: remove unused methods from UnsafeChannel * remove bodyAsCharSequenceStream operator * refactor: remove unnecessary methods on HttpData * refactor: re-implement `bodyAsStream` * refactor: remove unsafe modification of pipeline from HttpData * refactor: rename HttpData types * fix 2.12 build * refactor: remove type param * PR comment * PR comment * refaector: simplify releaseRequest * refactor: reorder methods in ServerResponseHandler * refactor: make methods final * refactor: rename HttpData traits * add `bodyAsByteArray` and derive `body` and `bodyAsString` from it. * add test: should throw error for HttpData.Incoming * Introduce `useAggregator` method on settings and use it everywhere * remove sharable from `ServerResponseHandler` * Update zio-http/src/main/scala/zhttp/http/Request.scala * refactor: remove unnecessary pattern matching * throw exception on unknown message type * simplify test * refactor: change order of ContentHandler. Move it before the RequestHandler * test: update test structure * refactor: move pattern match logic to WebSocketUpgrade * revert addBefore Change because of degrade in performance (#1089) * fix static server issue with streaming * take case of auto read if body is not used * autoRead when needed * Update zio-http/src/main/scala/zhttp/service/RequestBodyHandler.scala * Update zio-http/src/main/scala/zhttp/http/Response.scala * Update zio-http/src/main/scala/zhttp/http/Response.scala * remove test which is not used * Update zio-http/src/main/scala/zhttp/service/Handler.scala Co-authored-by: Shrey Mehta <36622672+smehta91@users.noreply.github.com> * Update zio-http/src/main/scala/zhttp/service/Handler.scala Co-authored-by: Shrey Mehta <36622672+smehta91@users.noreply.github.com> * style: fmt * exclude Head in 404 check Co-authored-by: Tushar Mathur <tusharmath@gmail.com> Co-authored-by: Shrey Mehta <36622672+smehta91@users.noreply.github.com> * Fix toByteBuf for streamed HttpData (#1118) * Fix toByteBuf for streamed HttpData * example: more secure string compare for login (#1120) * Feature: Introduced defect channel for `Http` (#1083) * Introduced defect channel for Http and added helpful combinators for error handling * Reformat code * Removed doubtful combinator Http.run * Simplified implementation of catchNonFatalOrDie * Simplified implementation of catchSome * Guarded Http.execute() with try-catch block in order to convert unexpectable exceptions to defects * Added test to check Http.catchSomeDefect catches throws defects * Fixed warnings about shadowing type parameters * Fix: fold over defect cause * Formatted HttpSpec.scala * Perf: catch defects only where they may occur * Fmt Co-authored-by: Nikolay Artamonov <n.artamonov@sigma-it.ru> * Enhancement: Merge server and client Responses (#1111) * Merge client and server Request * Remove IsResponse * rename getBodyAsString => bodyAsString in doc (#1124) * removed links from scaladoc (#1127) * Feature: Add `version` to `Request` (#1094) * introduce `Incoming` and `Outgoing` inHttpData * streaming support * benchmark disable objectAggregator * cleanup * refactor * cleanup + PR comments * cleanup + PR comments * cleanup + PR comments * refactor: rename variable * memory leak * refactor: Handler now extends ChannelInboundHandlerAdapter * refactor: remove unused methods from UnsafeChannel * remove bodyAsCharSequenceStream operator * refactor: remove unnecessary methods on HttpData * refactor: re-implement `bodyAsStream` * refactor: remove unsafe modification of pipeline from HttpData * refactor: rename HttpData types * fix 2.12 build * refactor: remove type param * PR comment * PR comment * refaector: simplify releaseRequest * refactor: reorder methods in ServerResponseHandler * refactor: make methods final * refactor: rename HttpData traits * add `bodyAsByteArray` and derive `body` and `bodyAsString` from it. * add test: should throw error for HttpData.Incoming * Introduce `useAggregator` method on settings and use it everywhere * remove sharable from `ServerResponseHandler` * Update zio-http/src/main/scala/zhttp/http/Request.scala * refactor: remove unnecessary pattern matching * throw exception on unknown message type * simplify test * refactor: change order of ContentHandler. Move it before the RequestHandler * test: update test structure * refactor: move pattern match logic to WebSocketUpgrade * revert addBefore Change because of degrade in performance (#1089) * fix static server issue with streaming * Introduce version in Request * Delete `Request.make` * add missing scaladoc Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Refactor: Merge client and server `Request` (#1125) * introduce `Incoming` and `Outgoing` inHttpData * streaming support * benchmark disable objectAggregator * cleanup * refactor * cleanup + PR comments * cleanup + PR comments * cleanup + PR comments * refactor: rename variable * memory leak * refactor: Handler now extends ChannelInboundHandlerAdapter * refactor: remove unused methods from UnsafeChannel * remove bodyAsCharSequenceStream operator * refactor: remove unnecessary methods on HttpData * refactor: re-implement `bodyAsStream` * refactor: remove unsafe modification of pipeline from HttpData * refactor: rename HttpData types * fix 2.12 build * refactor: remove type param * PR comment * PR comment * refaector: simplify releaseRequest * refactor: reorder methods in ServerResponseHandler * refactor: make methods final * refactor: rename HttpData traits * add `bodyAsByteArray` and derive `body` and `bodyAsString` from it. * add test: should throw error for HttpData.Incoming * Introduce `useAggregator` method on settings and use it everywhere * remove sharable from `ServerResponseHandler` * Update zio-http/src/main/scala/zhttp/http/Request.scala * refactor: remove unnecessary pattern matching * throw exception on unknown message type * simplify test * refactor: change order of ContentHandler. Move it before the RequestHandler * test: update test structure * refactor: move pattern match logic to WebSocketUpgrade * revert addBefore Change because of degrade in performance (#1089) * fix static server issue with streaming * Introduce version in Request * Merge Client and Server Request * Delete `Request.make` * Gen refactor * rename files * make function private * rename attribute * rename attribute Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Refactor: Http.Status names to Camel Case (#1129) * support custom Status for HtppError * support custom Status for HttpError * updated code based on review. * fixed tests * changed from Capitalized Status names to Camel Case * proper camel case usage Co-authored-by: Gabriel Ciuloaica <con_gabriel.ciuloaica@dream11.com> * Feature: Support Custom statuses code (#1121) * support custom Status for HtppError * support custom Status for HttpError * updated code based on review. * fixed tests * Refactor: Http.Status names to Camel Case (#1128) * changed from Capitalized Status names to Camel Case * proper camel case usage * Update zio-http/src/main/scala/zhttp/http/HttpError.scala Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * fixed after conflict * updated tests Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Enhancement: Added combine operator (#1106) * enhancement: added combine operator * added test cases with three apps * refactor: plaintextBenchmarkServer * test case updated * removed flatten from test * test case updated * added test for collectHttp * simplified tests * added failing test * fixed test * refactor: cleaning up the execute method in Http Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Refactor: Added lift in PartialCollect (#1105) * refactor: added lift in partialCollect * added text in path * refactor: reduce iterations of benchmarks Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Feature: Bearer auth middleware (#1097) * added header constructor for bearer authorization * added jwt auth middlewares * updated the Auth examples * added tests * renamed the auth middleware from jwt to barer * refactor: example AuthenticationClient * added scala doc for examples, renamed variables in tests Co-authored-by: Shubham Girdhar <girdharshubham@hotmail.com> Co-authored-by: amitsingh <amitksingh1490@gmail.com> * Update netty-all to 4.1.75.Final (#1130) * Refactor: `Request` and `Response` to extend `HttpDataExtension` (#1112) * Request Streaming Example * refactor: add HttpDataExtension * doc: add documentation * fix: compiler errors Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Refactor: Make `Http.getResource` consistent with `ZStream.fromResource` (#1113) * Fix `Http.getResource` Code based on https://github.com/zio/zio/blob/v1.0.13/streams/jvm/src/main/scala/zio/stream/platform.scala#L385-L398 * Improve `File` creation lazyness: The `File` instance will be created much later in the pipe * Fix tests * Fix tests * Update zio-http/src/main/scala/zhttp/http/Http.scala Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Remove `Blocking` from the type signature as requested Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * Update netty-incubator-transport-native-io_uring to 0.0.13.Final (#1133) * Add more useful toString method for Request (#995) * Add more useful toString method for Request * Fmt * Moved toString to Request trait * Added a few tests of Request.toString * Fmt * Improved tests for Request.toString * Added Scala doc for Request.toString * Added protocol version to a string representation of Request * Fmt * fix(request): fix scala doc (#1138) * Performance: Improve HttpData toByteBuf (#1137) * refactor: add blocking layer for file based constructors * refactor: use JavaFile instead of RandomAccessFile * doc: fix StaticServer example * style: scalafmt * refactor: clean up HttpData * refactor: remove blocking * refactor: remove unnecessary overload in ResponseHandler * test: add timeout and use ByteBufConfig to control encoding * refactor: add ByteBufConfig * refactor: rename types internally * style: fmt Co-authored-by: amitsingh <amitksingh1490@gmail.com> * Fix: Handle HttpClient Interruption on connection close (#1039) * the promise has to be uninteruptible to avoid loosing the response message in case the netty chanel is getting closed due to a unhandled exception * added a note about reasons why the promise is made uninterruptible. * New chapter: efficient development process (#1145) The dream11 gitter template already contains the most important sbt plugins to setup an efficient development process. To guide newcomers to zio-http, the newely added chapter gives an introduction on their purpose and how to use them. * do not watch reStop (#1146) Removed the tilde (~) before reStop, as it is not helpful to run this in watch-mode * Feature: add `Middleware.codecHttp` (#1141) * feature: add codecHttp * feature: add `codecMiddleware` to Http * added tests Co-authored-by: shrutiverma97 <shruti@dream11.com> * Performance: Use `CharSequence` internally wherever possible (#1142) * refactor: add blocking layer for file based constructors * refactor: use JavaFile instead of RandomAccessFile * doc: fix StaticServer example * style: scalafmt * refactor: clean up HttpData * refactor: remove blocking * refactor: remove unnecessary overload in ResponseHandler * test: add timeout and use ByteBufConfig to control encoding * refactor: add ByteBufConfig * performance: use `AsciiString` inside of HttpData * performance: use CharSequence in `Http.template` and `Http.text` * performance: use `CharSequence` in Response.json, Response.text and Response.redirect * performance: use `CharSequence` in Html templates * refactor: add `bodyAsCharSequence` to HttpDataExtension * Update scala-collection-compat to 2.7.0 (#1154) * Update jwt-core to 9.0.5 (#1150) * feature: add `narrow` operator to Http (#1161) * feature: add `toHttp` method to `Response` (#1160) * refactor: DynamicServer is not bound to HttpEnv only (#1159) * fix: Socket.end implementation (#1158) * Update sbt-scala3-migrate to 0.5.1 (#1163) * Fix: update implementation of `FromAsciiString.encode` (#1175) * fix: update implementation of `FromAsciiString.encode` * Add test for toHttp FromASCIIString Co-authored-by: amitsingh <amitksingh1490@gmail.com> * Build(deps): Bump minimist from 1.2.5 to 1.2.6 in /docs/website (#1172) Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6. - [Release notes](https://github.com/substack/minimist/releases) - [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6) --- updated-dependencies: - dependency-name: minimist dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Added missing period (#1186) * Update scalafmt-core to 3.5.0 (#1180) * Update sbt-scalafix to 0.10.0 (#1192) * Added workflow for Jmh benchmarks (#1135) * ci: added workflow for jmh benchmarks * workflow should run on label * added if in workflow * main and current in one machine * main and current in one machine * on push * removed java setup * format output * fomatting * added label trigger * Feature: add `delay` `tap` operator to Socket (#1157) * feature: add `delay` `tap` operator to Socket feature: add `tap` operator to Socket * Feature: add `from` and `fromIterable` * feature: add `narrow` operator to Http (#1161) * feature: add `toHttp` method to `Response` (#1160) * refactor: DynamicServer is not bound to HttpEnv only (#1159) * fix: Socket.end implementation (#1158) * Update sbt-scala3-migrate to 0.5.1 (#1163) * Fix: update implementation of `FromAsciiString.encode` (#1175) * fix: update implementation of `FromAsciiString.encode` * Add test for toHttp FromASCIIString Co-authored-by: amitsingh <amitksingh1490@gmail.com> * Build(deps): Bump minimist from 1.2.5 to 1.2.6 in /docs/website (#1172) Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6. - [Release notes](https://github.com/substack/minimist/releases) - [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6) --- updated-dependencies: - dependency-name: minimist dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * test: add tests for `tap` and `delay` * test: update test Co-authored-by: amitsingh <amitksingh1490@gmail.com> Co-authored-by: Amit Kumar Singh <amit.singh@dream11.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * getting started broken links fixed (#1196) * Update scala3-library to 3.1.2 (#1203) * Update scala3-library to 3.1.2 * Regenerate workflow with sbt-github-actions * Update netty-all to 4.1.76.Final (#1202) * Update zio, zio-streams, zio-test, ... to 1.0.14 (#1201) * Update scala3-library to 3.1.2 (#1197) * Update scala3-library to 3.1.2 * Regenerate workflow with sbt-github-actions * Added implicit conversion from Unit to Html (#1204) * Fix: Handle on-close interruption in websocket (#1156) * feature: add `delay` `tap` operator to Socket feature: add `tap` operator to Socket * fix: for websocket onClose * fix: for websocket onClose * feature: add `delay` `tap` operator to Socket feature: add `tap` operator to Socket * test for the onClose test: add WebSocketAppHandler test for close handler * refactor: use a promise based test * refactor: simplify `writeAndFlush` implementation in service * refactor: use Socket.end in test instead of closing connection * style: scalafmt * wip: add debug logs for upgrade * style: scalafmt * style: scalafmt * test: add debug log * wip: update log * style: scalafmt * wip: update Logging * refactor: fix spec * style: scalafmt * wip: trying to fix the test * revert: remove loggin * Feature: add `from` and `fromIterable` * feature: add `narrow` operator to Http (#1161) * feature: add `toHttp` method to `Response` (#1160) * refactor: DynamicServer is not bound to HttpEnv only (#1159) * fix: Socket.end implementation (#1158) * Update sbt-scala3-migrate to 0.5.1 (#1163) * Fix: update implementation of `FromAsciiString.encode` (#1175) * fix: update implementation of `FromAsciiString.encode` * Add test for toHttp FromASCIIString Co-authored-by: amitsingh <amitksingh1490@gmail.com> * Build(deps): Bump minimist from 1.2.5 to 1.2.6 in /docs/website (#1172) Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6. - [Release notes](https://github.com/substack/minimist/releases) - [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6) --- updated-dependencies: - dependency-name: minimist dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * test: add tests for `tap` and `delay` * test: update test Co-authored-by: Tushar Mathur <tusharmath@gmail.com> Co-authored-by: Shubham Girdhar <girdharshubham@hotmail.com> Co-authored-by: Gabriel Ciuloaica <con_gabriel.ciuloaica@dream11.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update scalafmt-core to 3.5.1 (#1212) * Update scalafmt-core to 3.5.1 * Reformat with scalafmt 3.5.1 * maintenance: bump version in website docs (#1177) * Refactor: ServerResponseHandler (#1198) * passed as instance * refactor * refactored ServerResponseHandler in zhttp.service * refactor * sealed trait changed to case class * moved ctx to package * private type * revert changes * renaming * removed config * Update scalafmt-core to 3.5.2 (#1218) * Update sbt-bloop to 1.5.0 (#1224) * feat: added channel option to Server (#1210) * feat: added channel option to Server * feat: added unsafe unsafe serverbootstrap * feat: minor change in the fn description * feat: formatting fix * feat: update doc Co-authored-by: Tushar Mathur <tusharmath@gmail.com> Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * refactor: move logic to ServerResponseWriter (#1223) * refactor: move logic to ServerResponseWriter * refactor: remove redundant parameter * test: update test for NotFound * test: update test for content-length on client * Feature: Add `merge` operator in `Http` (#1232) * feature: add Http.merge * style: use `,` instead of `+` to combine suites * test: add tests for Http.merge * add client server example (#1228) * Build(deps): Bump async from 2.6.3 to 2.6.4 in /docs/website (#1233) Bumps [async](https://github.com/caolan/async) from 2.6.3 to 2.6.4. - [Release notes](https://github.com/caolan/async/releases) - [Changelog](https://github.com/caolan/async/blob/v2.6.4/CHANGELOG.md) - [Commits](https://github.com/caolan/async/compare/v2.6.3...v2.6.4) --- updated-dependencies: - dependency-name: async dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * refactor: rename property in serverConfig (#1243) * Fix: Request Streaming (#1242) * chore: run tests in parallel * fix: request body issues * test: fix server spec test for decompression * Update netty-all to 4.1.77.Final (#1241) * Fix: Echo `HttpData` directly from `Request` (#1244) * test: add failing test for echoing raw data * fix: fix unsafe cast issue * test: simplify test case * Restore request method on client as public (#1247) * add empty and allow middleware (#1251) * Use zExec.unsafeRunInterruptible where appropriate (#1253) As a fix for #1147 zExec.unsafeRunInterruptible was created, because when using the pattern zExec.unsafeRun(<sometask>.uninterruptible) it was possible to be interrupted before <sometask> was started causing callbacks to be missed. Replacing the above with zExec.unsafeRunInterruptible(<sometask>) fixed this. This commit replaces the remaining instances of this pattern with unsafeRunUninterruptible. At least once of these fixes a similar race condition observed in #1252. Co-authored-by: Dennis Noordsij <dennis@iletsel.nl> * Update netty-incubator-transport-native-io_uring to 0.0.14.Final (#1248) * Update netty-incubator-transport-native-io_uring to 0.0.14.Final (#1249) * Fix: Request Streaming back pressure (#1188) * using a bounded queue of 1 element instead of ZIO.effectAsync to be able to control reading from channel. * integraiton test added * separated the streaming execution in its own test object * added unit test * fixed test for scala 2.12 * refactored tests after review * removed redundant test * refactor: move logic to ServerResponseWriter * refactor: remove UnsafeReadableChannel * added another example for File Streaming upload * fix tests * fixeed code after merge with main * removed unusefull example * formatting * added a request streaming integration test with larger file * refactor: cleanup UnsafeAsync * refactor: cleaning up the test * revert: serverspec * refactor: simplify the test Co-authored-by: Tushar Mathur <tusharmath@gmail.com> * chore remove unused file (#1258) * chore: remove unnecessary dependencies (#1255) * refactor: Client.socket now returns a ZManaged (#1259) * Refactor: Drop `Endpoint` API (#1264) * feature: Provide access to `ChannelHandlerContext` using `Http`. * refactor: Dropping the Endpoint API * Update scalafmt-core to 3.5.4 (#1265) * Update scalafmt-core to 3.5.4 * Reformat with scalafmt 3.5.4 * Fix: Middleware type issues (#1269) * feature: add `IsMono` type-constraint * refactor: add `MonoMiddleware` * fix: type params in middleware.identity and middleware.allow, middleware.when * Update scalafmt-core to 3.5.5 (#1270) * Update scalafmt-core to 3.5.5 * Reformat with scalafmt 3.5.5 * Maintenance: Add internal Logging capabilities using `zhttp.log` (#1115) * implemented logging configuration to be able to invesigate netty layer issues * the low level logger should be off by default. logback config should be set to info to not log during tests. * wip * using internal logging * implemented simple console logging that is not allocated any memory for the log content when it is disabled or the log level is not matching the log level of the content. * improved the logging api * udated workflow and added more logging * removed unused file * removed unused code. * extended loggig settings in configuration to provide ability to set different logging levels. * added more logging and set benchmark in DEBBUG mode. * fixed merge * fixed formatting * changed logging level to INFO * change logging level for confing details * disabled logging from benchmark * doc: add scala dzio-http/src/test/scala/zhttp/internal/HttpGen.scalaoc * remove: support logging of throwable * refactor: rename params * refactor: reorder methods * refactor: Move ConsoleLogger into LogFrontend * refactor: Simplify LoggerFactory * refactor: use `Logger.make` for generating a Logger * refactor: simplify LoggerMacro for 2.13 * refactor: simplify LogFrontend * refactor: move LogLine inside of LogFormat * refactor: add apply method on LogFormat * refactor: add LogTransport * refactor: add Glogger * working version after refactoring * more refactoring * added location information, from where the log has been invoked * fixed after merge * fixed scala 2.12 compilation * migrating scala 3 macro wip * re-implemented based on new design. Single LoggerTransport for now is implemented. * refactor: removed InternalLogger and the macro sbt package * wip adding another transport * updated ci workflow * fixed scala 3 macro * formatted * fixed scala 3 macro * removed compiler warning for scala 3 * more simplifications * added file transport implementation * added integration tests * updated usage of logger in zio-http * updated tests to use api for java 8 only, added tags support in LogFormat * updated test to work also with scala 2.12 * more simplifications * fixed imports * updated server API to allow users of the API to provide a custom logger * more simplifications - the name of the logger was redundant as we have tags and location as part of the log line * updated example and added more log to server implementation * undo the exmple changes * refactor: rename logLevels * refactor: make LoggerFactory.Live private * refactor: clean up the logger a bit * refactor: make LogTransport private to Logger * doc: add scala doc in netty logger * doc: update scala doc * chore: remove unnecessary build changes * refactor: LogFrontend and LoggerTransport * style: fmt * feature: add `autodetectLevel` and `startsWith` operators on Logger * feat: add `detectFromEnv` method to LogLevel * refactor: update Scala doc from Logger.scala * refactor: disable logging by default while reading loglevel from env * refactor: rename file * refactor: simplify LogTransport * feature: add `dispatch` and operators to modify tags * perf: optimize Logger's macro implementation * scala 3 macro fixes and other cosmetic changes * logger transport will discard the log line based on log transport log level. * used SourcePos instead of passing 2 values around, only trace will provide source location information * fixed flaky test * style: reorder methods in Server * feature: add More LogDetection logic * refactor: drop `tags` from LogStatement * feature: add splat operator for withTags * refactor: add `detechLevelFromProps` * chore: update default app to HelloWorld * refactor: cleanup LogFormat * refactor: remove redundant `withTag` operator * refactor: cleanup log statements in Server * performance: optimize scala 3 output * removed logging from API. the Log instance is created with LogLevel read from env. If the ZHTTP_LOG_LEVEL env variable is not defined then the Log instance has LogLevel set to Disable. * formatting * formatting * more tests for logger using an in memory transport * fixed for scala 2.12 * fix for scala 3 * removed logger api documentation * added empty line * update log tests * macro updated to check if the level is enabled for a certain log level * trading maintenability for performance: extended LoggerMacroExtension to provide enable checks for each level. * added isEnabled flag in logger * chore: set default LogLevel to INFO * style: remove unnecessary bracket * refactor: add Logging.scala * refactor: update ChannelInitializer LogStatement * refactor: Update log statement inside of runtime * refactor: Change default LogLevel to `Error` * refactor: use `SimpleName` for class names * formatting * removed debug log statements. * rolled back last change * minor correction in test name * short circuit the logl level cheks when logger is disabled * refactor: add more operators to compare LogLevel * chore: update scala-settings to ignore unused parameters * refactor: add detectedLogLevel * refactor: change dispatch signature * refactor: add tests for LogLevel * refactor: rename formats * refactor: clean-up logLevel * refactor: drop `Disable` level for Logging * refactor: LoggerTransport to become an abstract class * refactor: simplify LoggerSpec * chore: update build * chore: update ScalaSettings * if the env value is not matching any defined log levels, than the log level will be set to Error. Co-authored-by: Tushar Mathur <tusharmath@gmail.com> Co-authored-by: amitsingh <amitksingh1490@gmail.com> * Fix: Use `check` instead of `checkAll` (#1266) * replaced with in tests where the generator was non-deterministic, fixed URL spec. * updated on Cookie * updated cookie implementation to fix failing tests. There is one breaking change on the Cookie API - Cookie.decodeRequestCookie is returning LIst[String] * removed debug code * in case of empty AsciiString the ByteBuf should be empty * rolled back previous change. According to http spec header SHOULD be present in case the conntent is empty. * refactor: drop `Http.route` (#1271) * Doc: Middleware (#999) * outline for middleware documentation * addded transforming output middleware * added more * minor changes * minor changes * revert * changes * removed folder * added links * review changes * doc: updated * Added some background about need for Middlewares and handling aspects * arranging some lines * added example of cleaner code using middlewares * correcting statement * rectifying grammatical mistakes * some more grammar clean up * restructuring the doc; explain concepts without using lots of code * presenting middlewares * inserted a new line * A more elaborate introduction to middleware in zio-http * trim example code * added more step by step examples * detailed example of the operator ++ * corrected a sentence * improve description of ++ operator * improve description of ++ operator * simple examples for operators * mention combinators * correcting HTTP definition * incorporate feedback * difference b/w ++ and >>> operators …
fixes #1229
related to #1236