Coder Social home page Coder Social logo

Comments (5)

trezm avatar trezm commented on June 11, 2024 1

Good question(s)!

  • For the availability of set, have you imported the Context trait like the error is suggesting? It should be a public trait on any context, including BasicHyperContext.
  • For changing a header, is it enough to remove a header? The remove method also exists for headers (see here.) This should let you remove a header, update it to what you want, then add it again. One case that I can imagine this not supporting is if you needed the value previously set by another piece of middleware -- it might make sense to have remove return an Option<String>.

For what you tried, request is the incoming request, so grabbing any headers (or setting them!) would just affect the incoming side, not the outgoing side.

from thruster.

trezm avatar trezm commented on June 11, 2024 1

It's like you were originally asking -- set and remove alter the outgoing headers.

You just need to remember to include the Context trait via use thruster::Context;

from thruster.

Israel-Laguan avatar Israel-Laguan commented on June 11, 2024 1

So to answer me, import use thruster::Context allows modifying "outgoing" headers, no need to make "set" public.

from thruster.

Israel-Laguan avatar Israel-Laguan commented on June 11, 2024

For what you tried, request is the incoming request, so grabbing any headers (or setting them!) would just affect the incoming side, not the outgoing side.

Please explain to me how to change the outgoing headers 🥺 🙏🏻

from thruster.

Israel-Laguan avatar Israel-Laguan commented on June 11, 2024

I followed your suggestion and its working now:
image

image

Thanks for the help @trezm!

from thruster.

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.