Skip to content
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

feat: add OutgoingRequestInterface #6698

Merged
merged 9 commits into from
Oct 28, 2022

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Oct 16, 2022

Description
See #6573, #4356

  • add OutgoingRequest
  • add OutgoingRequestInterface
  • CURLRequest extends OutgoingRequest
  • Request extends OutgoingRequest
  • RequestInterface extends OutgoingRequestInterface

http://www.plantuml.com/plantuml/uml/ZP1TQWCX58NVNSKX2-XJ5n38IuMKbf0kGEoTGUhFLAzGADrxnQOIbCpaRPXpplUf-yGgSdPMB4f_g9cmEyZ77Ru501ZF52Ub2S-KKadb_uykViay1-Fd4trcIjnge2yc_vwszhTsDy6Y0hHLgR5Xt6B9aUTHrze3iPb6oYWVQJsbcrpJrguWlGvkE5JRrAOFJE2m84nzl-Q0yZ2N0F52caB4q_dy-b0x1Levr-x3KTwhRTKjOock2DzEnurtwyrrCwZ3twYfE-MFs9VlxEml

@startuml
package "CI4" {
    interface MessageInterface
    interface OutgoingRequestInterface extends MessageInterface
    interface RequestInterface extends OutgoingRequestInterface

    class Message implements MessageInterface
    class OutgoingRequest extends Message implements OutgoingRequestInterface
    note top of OutgoingRequest
      an outgoing request.
    end note

    class Request extends OutgoingRequest implements RequestInterface

    class IncomingRequest extends Request
    note top of IncomingRequest
      an incoming request for HTTP.
    end note

    class CLIRequest extends Request
    note top of CLIRequest
      an incoming request for CLI.
    end note

    class CURLRequest extends OutgoingRequest
}
@enduml

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added bug Verified issues on the current code behavior or pull requests that will fix them breaking change Pull requests that may break existing functionalities 4.3 labels Oct 16, 2022
@kenjis kenjis force-pushed the add-OutgoingRequestInterface branch from 5589339 to d6150ff Compare October 16, 2022 11:53
@MGatner
Copy link
Member

MGatner commented Oct 17, 2022

I'm not sure if you implemented it this way because of the restrictions in our current HTTP layer, but the inheritance path for requests is confusing. What is restricting us from making Request a common base for both Incoming and Outgoing, and those not being in the same path?

@kenjis
Copy link
Member Author

kenjis commented Oct 17, 2022

PSR-7: MessageInterface > RequestInterface (outgoing) > ServerRequestInterface (incomming)
This PR: MessageInterface > OutgoingRequestInterface (outgoing) > RequestInterface (incomming)

What is restricting us from making Request a common base for both Incoming and Outgoing

CI4's Request is incomming request.

@kenjis kenjis added the docs needed Pull requests needing documentation write-ups and/or revisions. label Oct 17, 2022
@MGatner
Copy link
Member

MGatner commented Oct 18, 2022

Wow you are totally right! TIL an incoming request is actually an outgoing request with some extra methods.

So next question... why the new class? If we already have Message > Request > IncomingRequest, what is stopping us from making Request into the equivalent of OutgoingRequest? (sorry if this is obvious, it is very hard to flip between interfaces on mobile)

@kenjis
Copy link
Member Author

kenjis commented Oct 18, 2022

what is stopping us from making Request into the equivalent of OutgoingRequest?

The reason for adding the new class is to make as few changes as possible.

RequestInterface is incoming request in CI4.
If we change Request to outgoing request, it seems better to change RequestInterface to outgoing request.
Then we need to add IncommingRequestInterface.

Do you mean like this?
MessageInterface -> Message
OutgoingRequestInterface -> Request
RequestInterface -> IncommingRequest

@MGatner
Copy link
Member

MGatner commented Oct 19, 2022

I'm with you now, took me a little bit. The structure and names are confusing, but that's not your fault. I would like to look at this one more time on desktop, but generally I think it is a good direction and you should feel free to proceed with the docs.

@kenjis kenjis force-pushed the add-OutgoingRequestInterface branch from 2404804 to eda2615 Compare October 20, 2022 09:02
@kenjis
Copy link
Member Author

kenjis commented Oct 20, 2022

Added changelog.

Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're there! I would like one other set of eyes here. @paulbalandan or @samsonasik or @iRedds ?

@kenjis kenjis removed the docs needed Pull requests needing documentation write-ups and/or revisions. label Oct 21, 2022
@kenjis kenjis force-pushed the add-OutgoingRequestInterface branch from eda2615 to d58f681 Compare October 24, 2022 23:37
@kenjis kenjis force-pushed the add-OutgoingRequestInterface branch from d58f681 to 583689c Compare October 26, 2022 08:20
@kenjis kenjis merged commit 949b622 into codeigniter4:4.3 Oct 28, 2022
@kenjis kenjis deleted the add-OutgoingRequestInterface branch October 28, 2022 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Pull requests that may break existing functionalities bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants