Code Monkey home page Code Monkey logo

Comments (5)

beetlex-io avatar beetlex-io commented on June 11, 2024 1

刚更新了版本,把这个一同添加了
Response.CookieSecure有这个属性设置

from fasthttpapi.

beetlex-io avatar beetlex-io commented on June 11, 2024 1

继承OptionsAttribute类重写SetResponse,自己把内容加到输出头上
以下是默认实现

        public virtual void SetResponse(HttpRequest request, HttpResponse response)
        {
            HttpApiServer server = request.Server;
            if (server.EnableLog(EventArgs.LogType.Debug))
                server.Log(EventArgs.LogType.Debug, request.Session, $"{request.RemoteIPAddress} {request.Method} {request.Url} set options");
            response.Header["Access-Control-Allow-Origin"] = AllowOrigin;
        }

from fasthttpapi.

senioi avatar senioi commented on June 11, 2024

CookieSecure

感谢大佬回复,目前还有个问题,
AllowCredentials = "true" 目前FastHttpApi只回复OPTIONS请求,而POST或者GET(允许的请求)没有附带这个头
image
如果再次POST的时候,会收到如下提示:
image
这个错误是服务器没返回AllowCredentials = "true" ,应该是所有请求都要包含这个

from fasthttpapi.

beetlex-io avatar beetlex-io commented on June 11, 2024

在控制上标记OptionsAttribute属性,在get或post请求时会输出的

from fasthttpapi.

senioi avatar senioi commented on June 11, 2024

onsAttribute类重写SetResponse,自己把内容加到输出头上
以下是默认实现

感谢大佬给出解决方案,希望大佬下次有空的时候更新下AllowCredentials = "true" ,在除了"OPTIONS"之外的请求附带这个头(如果设置了的话)

from fasthttpapi.

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.