RESTTestのパッチが取り込まれるまでの流れ
岩本さんもありがとうございます。
RESTful webサービス(7章 リベンジ) - winplusの日記
いえ、お礼を言われるようなことは何もしてないので、それを証明したいと思います(えー)。
「RESTTestを改造してみた」で書いたように、RESTTestは便利だったんですが、かゆいところに手が届かない感じがあったので、腐ってもエンジニア、自分で改造してみようと思い立ちました。
XULのことは何も知らなかったのですが、チュートリアルやリファレンスを見ながらコードを書き換え、どうにか自分の思い通りになりました。変更箇所は下記の通りです。
--- tester.xul.org 2007-10-22 20:52:00.000000000 +0900 +++ tester.xul 2008-01-19 14:11:01.962638400 +0900 @@ -7,9 +7,10 @@ <dialog id="http-tester" title="RESTTest - HTTP Tester" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" - buttons="accept,cancel" - ondialogaccept="sendRequest();return true;" + buttonlabelcancel="Close" + buttons="cancel" ondialogcancel="return true;" + onload="byId('url').focus();" onunload="return true;" persist="width height screenX screenY"> <script type="application/x-javascript" src="chrome://resttest/content/requester.js"/> @@ -20,21 +21,30 @@ <caption id="uri text" label="Request" crop="end"/> <hbox align="center"> <label value="URL" /> - <textbox id="url" flex="1" type="text" /> + <textbox id="url" flex="1" type="autocomplete" autocompletesearch="history" value="http://" onkeypress="if (event.keyCode == 13) {sendRequest(); return false;}"/> </hbox> <hbox align="center"> <label value="Method" control="method.input"/> - <textbox id="method" flex="1" type="text" value="GET"/> + <menulist id="method" editable="true" onkeypress="if (event.keyCode == 13) {sendRequest(); return false;}"> + <menupopup> + <menuitem label="GET"/> + <menuitem label="HEAD"/> + <menuitem label="POST"/> + <menuitem label="PUT"/> + <menuitem label="DELETE"/> + <menuitem label="OPTIONS"/> + </menupopup> + </menulist> </hbox> <hbox align="center"> <label value="Headers"/> - <textbox id="headers" rows="5" value="Content-Type: application/x-www-form-urlencoded" multiline="true" flex="15" type="text" /> + <textbox id="headers" rows="3" value="Content-Type: application/x-www-form-urlencoded" multiline="true" flex="15" type="text" /> </hbox> <hbox align="center"> <label value="POST/PUT data"/> - <textbox id="data" rows="10" multiline="true" wrapAround="true" flex="15" type="text" /> + <textbox id="data" rows="4" multiline="true" wrapAround="true" flex="15" type="text" /> </hbox> - <hbox align="center"> + <hbox align="right"> <button id="button" label="Send" onclick="sendRequest()"/> </hbox> </groupbox> @@ -46,8 +56,12 @@ <label value="" id="status"/> </hbox> <hbox align="center"> + <label value="Response Headers"/> + <textbox id="response_headers" rows="5" value="" multiline="true" flex="15" type="text"/> + </hbox> + <hbox align="center"> <label value="Response Text" /> - <textbox id="response" rows="10" multiline="true" wrapAround="true" flex="15" type="text" /> + <textbox id="response" rows="8" multiline="true" wrapAround="true" flex="15" type="text" /> </hbox> </groupbox> </vbox> --- requester.js.org 2007-10-22 20:23:00.000000000 +0900 +++ requester.js 2008-01-19 13:35:19.491916800 +0900 @@ -5,12 +5,14 @@ if (xhr.readyState == 4) {// only if "OK" try { byId("status").value = xhr.status; + byId("response_headers").value = xhr.getAllResponseHeaders(); byId("response").value = xhr.responseText; } catch(e) {byId("status").value = "no response";} } } byId("status").value = "processing"; + byId("response_headers").value = ""; byId("response").value = ""; xhr.onreadystatechange = ajaxDataReader; try {
たいした変わってないですねえ。
が、使ってみるとなかなか便利。「これが本家に取り込まれればみんなも便利だと思うよ」と白岩本がささやき、「自分の名前が残ればお前の自己顕示欲が満たせるぜ」と黒岩本がそそのかすので、作者宛てにパッチを送ってみようと思いました。「英語メールの書き方」みたいなサイトを参考に書き、送信したのが下記の内容です。たぶんひどい英語だと思います(恥)。
Dear Kris, My name is IWAMOTO Takashi and I'm a user of your RestTest in Japan. The reason why I'm writing this email to you is I'd like to show my patch. I think that it make RestTest more useful. Its strong points are: * Auto-completed Request URL * Selectable Request Method * Sending by Enter key * Showing Response Headers I'd appreciate it if you could check my patch. Thank you very much for reading this email. Sincerely, -- IWAMOTO Takashi
10時間後、パッチを取り込んだ旨の返信が作者からありました。
IWAMOTO, Thank you very much, your patch is fantastic. I have updated RestTest (http://www.xucia.com/page/RestTest) your patch. Thanks again, Kris
「fantasticは言い過ぎだろ」と思いながらも、たぶんしばらくニヤニヤしてたと思います。黒岩本の顔で。