Giter Club home page Giter Club logo

Comments (5)

adamw avatar adamw commented on June 7, 2024

I think we'll need more detail to understand what's the problem :)

From what version to which one did you update?
What's the endpoint's definition? And what is an example failing request?

from tapir.

morvaridmf avatar morvaridmf commented on June 7, 2024

It has been quite a while since we last updated the version. Specifically, we were using version 0.19.4 before updating to the latest release.

the issue is we have two end points (importJobs) and (import-jobs), before updating the version both 2 end points were working fine, but after updating all the test related to (import-jobs) end point failed. I changed the (import-jobs) to (import-job) and that worked fine, so I am wondering what can be the issue?

here is the piece of code I'm referring
val importJobsOld: EndpointTypeAuthInQuery[Unit, Set[ImportJob]] =
.in("importJobs")
.name("getImportJobsOld")
.summary("Get Import Jobs")
.get
.out(jsonBody[Set[ImportJob]].addOKDes())
.description("Get a list of all import jobs")

val importJobs: EndpointTypeAuthInQuery[Unit, Set[ImportJob]] =
.in("import-jobs")
.name("getImportJobs")
.summary("Get Import Jobs")
.get
.out(jsonBody[Set[ImportJob]].addOKDes())
.description("Get a list of all import jobs")

from tapir.

adamw avatar adamw commented on June 7, 2024

I tested an endpoint using an "import-jobs" path and everything worked correctly. A response code 405 indicates that the wrong HTTP method is used. Are you issuing GET requests as described by the endpoint defition? (which seems incomplete)

from tapir.

morvaridmf avatar morvaridmf commented on June 7, 2024

would you please try it with having 2 endpoints at the same time, import-jobs and importJobs?
the issue that we are facing is when we use 2 endpoints with the names I mentioned above.

from tapir.

adamw avatar adamw commented on June 7, 2024

Sure, works fine:

import sttp.tapir.*
import sttp.tapir.server.netty.sync.{Id, NettySyncServer}

object HelloWorldNettySyncServer extends App:
  val e1 = endpoint.get
    .in("import-jobs")
    .out(stringBody)
    .serverLogicSuccess[Id](_ => "1")

  val e2 = endpoint.get
    .in("importJobs")
    .out(stringBody)
    .serverLogicSuccess[Id](_ => "2")

  NettySyncServer().addEndpoint(e1).addEndpoint(e2).startAndWait()

test:

[~]% curl http://localhost:8080/import-jobs
1
[~]% curl http://localhost:8080/importJobs
2

from tapir.

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.