MCPcopy Create free account
hub / github.com/Helidium/Mitol / GetHeader

Method GetHeader

node/http.h:97–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95 }
96
97 static void GetHeader(Local<String> property, const PropertyCallbackInfo<Value> &args) {
98 String::Utf8Value name(property);
99
100 MNS::SocketData *data = static_cast<MNS::SocketData *>(args.Holder()->GetPrototype()->ToObject()->GetAlignedPointerFromInternalField(0));
101
102 if(data) {
103 std::map<std::string, std::string>::const_iterator it = data->request->headers.find(std::string(*name, name.length()));
104
105 if (it != data->request->headers.end()) {
106 args.GetReturnValue().Set(String::NewFromOneByte(args.GetIsolate(), (uint8_t *) it->second.c_str(), String::kNormalString, it->second.length()));
107 } else {
108 args.GetReturnValue().Set(Undefined(args.GetIsolate()));
109 }
110 }
111 }
112
113 static void GetSocket(Local<String> property, const PropertyCallbackInfo<Value> &args) {
114 // TODO

Callers

nothing calls this directly

Calls 1

endMethod · 0.80

Tested by

no test coverage detected