/*
支持方法
'GET',      // 从服务器取出资源（一项或多项）
'POST',     // 在服务器新建一个资源
'PUT',      // 在服务器更新资源（客户端提供改变后的完整资源）
'PATCH',    // 在服务器更新资源（客户端提供改变的属性）
'DELETE',   // 从服务器删除资源
'HEAD',     // 获取 head 元数据
'OPTIONS',  // 获取信息，关于资源的哪些属性是客户端可以改变的
509469
function __hook(?string $actionName, Request $request, Response $response):?string
    {
        $actionName = $request->getMethod().ucfirst($actionName);
        return parent::__hook($actionName, $request, $response);
    }
701808
func main() {

	// init a connection
	s, err := solr.Init("localhost", 8983, "collection-name")

	if err != nil {
		fmt.Println(err)
		return
	}

	// build an update document, in this case removing two documents
	f := map[string]interface{}{
		"delete": map[string]interface{}{
			"id": 22,
		},
	}

	// send off the update (2nd parameter indicates we also want to commit the operation)
	resp, err := s.Update(f, true)

	if err != nil {
		fmt.Println("error =>", err)
	} else {
		fmt.Println("resp =>", resp)
	}
}
758130
func (c *Client) Put() {
	select {
	case b := <-c.sent:
		c.p.ch <- b
	default:
	}
}
1309737
func (bp *Pool) Put(obj interface{}) {
	finalize := true
	if bp.CanReturn == nil || bp.CanReturn(obj) {
		finalize = !bp.pool.Offer(obj)
	}

	if finalize && bp.Finalize != nil {
		bp.Finalize(obj)
	}
}
305670
func (m *Mux) Put(pattern string, handler http.HandlerFunc) {
	m.Handle(http.MethodPut, pattern, handler)
}
1193546
func (session *Session) Put(path string, params Params) (Result, error) {
	return session.Api(path, PUT, params)
}
1188242
function sendRequest(method, path, data, callback) {
  if (!CONFIG.isInitialized) {
    throw ERROR_MESSAGE.initializeRequired;
  }

  log("==================================================");
  log("The data below will be sent");
  log("==================================================");
  log(data);

  let dataString = querystring.stringify(data);

  let headers = {
    "Content-Type": "application/x-www-form-urlencoded"
  };

  // 使用 POST 時設定 Content-Length 標頭
  if (method === "POST") {
    headers["Content-Length"] = dataString.length;
  } else {
    path = `${path}?${dataString}`;
  }

  let options = {
    host: CONFIG.host,
    port: CONFIG.port,
    path: path,
    method: method,
    headers: headers
  };

  let request;
  if (!CONFIG.useSSL) {
    request = http.request(options);
  } else {
    request = https.request(options);
  }

  log("==================================================");
  log("HTTP/HTTPS request options");
  log("==================================================");
  log(options);

  if (method === "POST") {
    log("==================================================");
    log("Send request");
    log("==================================================");
    log(dataString);
    request.write(dataString);
  }

  request.end();

  let buffer = "";
  request.on("response", (response) => {
    response.setEncoding("utf8");

    response.on("data", (chunk) => {
      buffer += chunk;
    });

    response.on("end", () => {
      let responseData;

      log("==================================================");
      log("Response data");
      log("==================================================");
      log(buffer);

      if (callback) {
        let err = undefined;

        // 另外處理非 JSON 物件的返回值
        if (NON_JSON_RESPONSE_ENDPOINT.indexOf(path) > -1) {
          if (response.statusCode === 200) {
            if (path === ENDPOINT.aioChargeback) {
              let [status, message] = buffer.split("|");
              responseData = {
                status: status,
                message: message
              };
            } else {
              responseData = {};
              let responseArr = buffer.split("&");
              responseArr.forEach((param) => {
                let [key, value] = param.split("=");
                responseData[key] = value;
              });
            }
          } else {
            err = response.statusCode;
          }
        } else {
          try {
            responseData = JSON.parse(buffer);
          } catch (error) {
            log("==================================================");
            log("Could not convert API response to JSON, the error below is ignored and raw API response is returned to client");
            log("==================================================");
            log(error);
            err = error;
          }
        }

        callback(err, responseData);
      }
    });

    response.on("close", (err) => {
      log("==================================================");
      log("Problem with API request detailed stacktrace below");
      log("==================================================");
      log(err);
      sendErrorResponse(err, callback);
    });
  });

  request.on("error", (err) => {
    log("==================================================");
    log("Problem with API request detailed stacktrace below");
    log("==================================================");
    log(err);
    sendErrorResponse(err, callback);
  });
}
870578
func (_m *Client) Update(uid string, pu groveclient.PostUpdate, options groveclient.UpdateOptions) (*groveclient.PostItem, error) {
	ret := _m.Called(uid, pu, options)

	var r0 *groveclient.PostItem
	if rf, ok := ret.Get(0).(func(string, groveclient.PostUpdate, groveclient.UpdateOptions) *groveclient.PostItem); ok {
		r0 = rf(uid, pu, options)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*groveclient.PostItem)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(string, groveclient.PostUpdate, groveclient.UpdateOptions) error); ok {
		r1 = rf(uid, pu, options)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
1165229
func (this *Server) Get(path string, fn ...func(*Request, *Response, func())) string {

	/*
	   If there is no function then this is really a call to .Set()
	*/

	if len(fn) == 0 {
		return this.Set(path)
	}

	/*
	   Otherwise it's a call to .Verb()
	*/

	this.Verb("GET", path, fn...)

	return ""
}
1327752
func (r Response) Apply() error {
	var req, opts, err = r.applyRequest()

	if err != nil {
		return err
	}

	return r.applyUpdate(req, opts)
}
83108
func init() {
	Skins.db = make(map[string]Skin)

	Skins.AddSkin("default", Skin{
		Up: &SkinDirection{
			Head: "  ╚⊙ ⊙╝  ",
			Pede: []string{"╚═(███)═╝"},
		},
		Down: &SkinDirection{
			Head: "  ╔⊙ ⊙╗  ",
			Pede: []string{"╔═(███)═╗"},
		},
	})

	Skins.AddSkin("frozen", Skin{
		Up: &SkinDirection{
			Head: "  ╚⊙ ⊙╝  ",
			Pede: []string{"╚═(❄❄❄)═╝"},
			Tail: "    ❄    ",
		},
		Down: &SkinDirection{
			Head: "  ╔⊙ ⊙╗  ",
			Pede: []string{"╔═(❄❄❄)═╗"},
			Tail: "    ❄    ",
		},
	})

	Skins.AddSkin("diagonals", Skin{
		Up: &SkinDirection{
			Head: "  ╚⊙ ⊙╝  ",
			Pede: []string{"\\/(███)\\/", "/\\(███)/\\"},
		},
		Down: &SkinDirection{
			Head: "  ╔⊙ ⊙╗  ",
			Pede: []string{"/\\(███)/\\", "\\/(███)\\/"},
		},
	})

	Skins.AddSkin("corporate", Skin{
		Up: &SkinDirection{
			Head: "  ╚⊙ ⊙╝  ",
			Pede: []string{"╚═(©©©)═╝"},
		},
		Down: &SkinDirection{
			Head: "  ╔⊙ ⊙╗  ",
			Pede: []string{"╔═(©©©)═╗"},
		},
	})

	Skins.AddSkin("love", Skin{
		Up: &SkinDirection{
			Head: "  ╚⊙ ⊙╝  ",
			Pede: []string{"╚═(♥♥♥)═╝"},
		},
		Down: &SkinDirection{
			Head: "  ╔⊙ ⊙╗  ",
			Pede: []string{"╔═(♥♥♥)═╗"},
		},
	})

	Skins.AddSkin("musician", Skin{
		Up: &SkinDirection{
			Head: "  ╚⊙ ⊙╝  ",
			Pede: []string{"╚═(♫♩♬)═╝"},
		},
		Down: &SkinDirection{
			Head: "  ╔⊙ ⊙╗  ",
			Pede: []string{"╔═(♫♩♬)═╗"},
		},
	})

	Skins.AddSkin("bocal", Skin{
		Up: &SkinDirection{
			Head: "  ╚⊙ ⊙╝  ",
			Pede: []string{"╚═(🐟🐟🐟)═╝"},
		},
		Down: &SkinDirection{
			Head: "  ╔⊙ ⊙╗  ",
			Pede: []string{"╔═(🐟🐟🐟)═╗"},
		},
	})

	Skins.AddSkin("ascii", Skin{
		Up: &SkinDirection{
			Head: "  \\o o/  ",
			Pede: []string{"|=(###)=|"},
		},
		Down: &SkinDirection{
			Head: "  /o o\\  ",
			Pede: []string{"|=(###)=|"},
		},
	})

	Skins.AddSkin("inception", Skin{
		Up: &SkinDirection{
			Head: "    👀    ",
			Pede: []string{"╚═(🐛🐛🐛)═╝"},
		},
		Down: &SkinDirection{
			Head: "    👀    ",
			Pede: []string{"╔═(🐛🐛🐛)═╗"},
		},
	})

	Skins.AddSkin("humancentipede", Skin{
		Up: &SkinDirection{
			Head: "    👀    ",
			Pede: []string{"╚═(😷😷😷)═╝"},
		},
		Down: &SkinDirection{
			Head: "    👀    ",
			Pede: []string{"╔═(😷😷😷)═╗"},
		},
	})

	Skins.AddSkin("finger", Skin{
		Up: &SkinDirection{
			Head: "    👀    ",
			Pede: []string{"👈~~~  ~~~👉"},
		},
		Down: &SkinDirection{
			Head: "    👀    ",
			Pede: []string{"👈~~~~~~~~👉"},
		},
	})

	Skins.AddSkin("handy", Skin{
		Up: &SkinDirection{
			Head: "    👀    ",
			Pede: []string{"╚═(👌👌👌)═╝"},
		},
		Down: &SkinDirection{
			Head: "    👀    ",
			Pede: []string{"╔═(👌👌👌)═╗"},
		},
	})

	Skins.AddSkin("human", Skin{
		Up: &SkinDirection{
			Head: " ( ͡° ͜ʖ ͡°)",
			Pede: []string{"👆 ......👆"},
		},
		Down: &SkinDirection{
			Head: " ( ͡° ͜ʖ ͡°)",
			Pede: []string{"👇 ......👇"},
		},
	})
}
293837
func (c *Context) Get(class, id string) (*payload.Payload, error) {
	fullID := payload.BuildID(class, id)
	logger.Tracef("getting %q from hook context", fullID)

	actual, ok := c.updates[fullID]
	if !ok {
		actual, ok = c.payloads[fullID]
		if !ok {
			return nil, errors.NotFoundf("%s", fullID)
		}
	}
	return &actual, nil
}
78256
func (s *authKeyV1) Put() interface{} {
	var handler AuthPutHandler = func(params martini.Params, log *log.Logger, r render.Render, tokens oauth2.Tokens) {
		var (
			err    error
			apikey string
		)
		log.Println("executing the put handler")
		username := params[UserParam]
		userInfo := GetUserInfo(tokens)
		details, _ := json.Marshal(userInfo)

		NewUserMatch().
			UserInfo(userInfo).
			UserName(username).
			OnSuccess(func() {
			log.Println("getting userInfo: ", userInfo)

			if err = s.keyGen.Delete(username); err != nil {
				log.Println("keyGen.Delete error: ", err)
			}

			if err = s.keyGen.Create(username, string(details[:])); err != nil {
				log.Println("keyGen.Create error: ", err)
			}

			if apikey, err = s.keyGen.Get(username); err != nil {
				log.Println("keyGen.Get error: ", err)
			}
		}).
			OnFailure(func() {
			err = ErrInvalidCallerEmail
			log.Println("invalid user token error: ", err)
		}).Run()

		genericResponseFormatter(r, apikey, userInfo, err)
	}
	return handler
}
479955
function getHooks(obj, key, opts) {
    let pres = null, posts = null;
    if (key) {
        if (obj) {
            const routeHooks = obj.routeHooks;
            if (routeHooks && routeHooks[key]) {
                if (routeHooks[key].pre) {
                    pres = Array.isArray(routeHooks[key].pre) ? routeHooks[key].pre : [routeHooks[key].pre];
                }
                if (routeHooks[key].post) {
                    posts = Array.isArray(routeHooks[key].post) ? routeHooks[key].post : [routeHooks[key].post];
                }
            }
        }
        // 添加全局hook：全局hook最先被执行
        const globalHooks = opts.globalRouteHooks || {};
        if (globalHooks[key]) {
            const globalPres = globalHooks[key].pre;
            const globalPosts = globalHooks[key].post;
            if (typeof globalPres === 'function') {
                pres = Array.isArray(pres) ? pres : [];
                pres.unshift(globalPres);
            } else if (Array.isArray(globalPres) && globalPres.length > 0) {
                pres = Array.isArray(pres) ? pres : [];
                pres = globalPres.concat(pres);
            }
            if (typeof globalPosts === 'function') {
                posts = Array.isArray(posts) ? posts : [];
                posts.unshift(globalPosts);
            } else if (Array.isArray(globalPosts) && globalPosts.length > 0) {
                posts = Array.isArray(posts) ? posts : [];
                posts = globalPosts.concat(posts);
            }
        }
    }
    return { pres, posts };
}
1055775
func (r *Request) Put(url string) (*Response, error) {
	return r.Execute(MethodPut, url)
}
542056
func (e *Expect) PATCH(path string, pathargs ...interface{}) *Request {
	return e.Request("PATCH", path, pathargs...)
}
1191127
func (p *MemPostings) Get(name, value string) Postings {
	var lp []uint64
	p.mtx.RLock()
	l := p.m[name]
	if l != nil {
		lp = l[value]
	}
	p.mtx.RUnlock()

	if lp == nil {
		return EmptyPostings()
	}
	return newListPostings(lp...)
}