Git Product home page Git Product logo

Comments (7)

shenqidebaozi avatar shenqidebaozi commented on July 22, 2024 1

The 'your handle' in the figure refers to your business logic method defined through protobuf, not the HTTP handle

from kratos.

kratos-ci-bot avatar kratos-ci-bot commented on July 22, 2024

Bot detected the issue body's language is not English, translate it automatically. πŸ‘―πŸ‘­πŸ»πŸ§‘β€πŸ€β€πŸ§‘πŸ‘«πŸ§‘πŸΏβ€πŸ€β€πŸ§‘πŸ»πŸ‘©πŸΎβ€πŸ€β€πŸ‘¨πŸΏπŸ‘¬πŸΏ


image

I saw this is introduced in the document, and the picture is in line with my understanding.

But in actual operation, I got different log output:
image

Is my usage posture wrong? I am learning this: https://github.com/go-kratos/examples/blob/main/http/middlewares/main.go

from kratos.

shenqidebaozi avatar shenqidebaozi commented on July 22, 2024

The printed results are consistent with the diagram, and the onion ring model itself is like this

from kratos.

ChangSZ avatar ChangSZ commented on July 22, 2024

The printed results are consistent with the diagram, and the onion ring model itself is like this

Shouldn't the expected result be like this?

service middleware in
service middleware 2 in
INFO msg=sayHelloHandler
service middleware 2 out
service middleware out

And I saw that if you only set this setting, the middleware will not take effect.

	var opts = []http.ServerOption{
		http.Address(":8000"),
		http.Middleware(
			serviceMiddleware,
			serviceMiddleware2,
		),
	}
	httpSrv := http.NewServer(opts...)

Please guide me, I don’t know where the problem is with the settings. 🫰

from kratos.

shenqidebaozi avatar shenqidebaozi commented on July 22, 2024

HTTP middleware only works on routes defined through protobuf, and the use cases in the example are all tested. Please check your own code

from kratos.

shenqidebaozi avatar shenqidebaozi commented on July 22, 2024

In addition, the schematic in the figure is only for middleware and does not include HTTP filter

from kratos.

ChangSZ avatar ChangSZ commented on July 22, 2024

HTTP middleware only works on routes defined through protobuf, and the use cases in the example are all tested. Please check your own code

Ok, I see~ My understanding of this component is biased, thank you for correcting me

from kratos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.