Git Product home page Git Product logo

Comments (2)

zeroflag avatar zeroflag commented on July 17, 2024 1

Hi @sebastianconcept, thanks for reporting this.

Just to be sure I'm understand the problem properly, is the main goal to set the response headers on an aborted response?

If yes, then I think this way it should work:

Teapot stopAll.

Teapot on
  GET: '/' -> [:req | 
    req abort:
      (TeaResponse unauthorized   
        headers: { 'test-header' -> 'test-value' } asDictionary;
        yourself).
];
start.
$ curl -v http://localhost:1701/
*   Trying ::1...
* TCP_NODELAY set
* Connection failed
* connect to ::1 port 1701 failed: Connection refused
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 1701 (#0)
> GET / HTTP/1.1
> Host: localhost:1701
> User-Agent: curl/7.64.1
> Accept: */*
> 
< HTTP/1.1 401 Unauthorized
< Server: Zinc HTTP Components 1.0 (Pharo/10.0)
< Date: Sun, 29 Jan 2023 20:35:34 GMT
< test-header: test-value
< Content-Type: text/html;charset=utf-8
< Content-Length: 2
< 

Please let me know if I misunderstood something.

from teapot.

sebastianconcept avatar sebastianconcept commented on July 17, 2024 1

Oh missed that we can do that. Closing it. Thank you @zeroflag !

from teapot.

Related Issues (15)

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.