prototype.jsのput

多分既知なんだろうけど、prototype.jsでputを指定すると、パラメーターに'_method=put'がつく。

RESTでアプリを作りたいときには、このパラメーターで条件判断しろということらしいのだが、putでかつXML文書を送りたいときには、この_methodのパラメータがつかない。

んー、何の為のputサポートなんだろうか? パラメータでなくヘッダーに「X-Emurate-Method」とかにしてくれればいいのに。

  request: function(url) {
    this.url = url;
    this.method = this.options.method;
    var params = Object.clone(this.options.parameters);

    if (!['get', 'post'].include(this.method)) {
      // simulate other verbs over post
      params['_method'] = this.method;
      this.method = 'post';
    }

    this.parameters = params;

    // 中略...
      this.body = this.method == 'post' ? (this.options.postBody || params) : null;
      this.transport.send(this.body);

      /* Force Firefox to handle ready state 4 for synchronous requests */
      if (!this.options.asynchronous && this.transport.overrideMimeType)
        this.onStateChange();

    }
    catch (e) {
      this.dispatchException(e);
    }
  },