@@ -114,8 +114,6 @@ private function convertParm($parm)
114114 public function get ($ parm , $ function )
115115 {
116116 $ parm = $ this ->convertParm ($ parm );
117- // echo $this->removePhpUrl($_SERVER['REQUEST_URI']) . "===" . $parm . "<br/>";
118-
119117 if ($ _SERVER ['REQUEST_METHOD ' ] !== 'GET ' ) {
120118 return ;
121119 } else if (strcmp ($ this ->removePhpUrl ($ _SERVER ['REQUEST_URI ' ]), $ parm )) {
@@ -128,57 +126,62 @@ public function get($parm, $function)
128126
129127 public function post ($ parm , $ function )
130128 {
129+ $ parm = $ this ->convertParm ($ parm );
131130 if ($ _SERVER ['REQUEST_METHOD ' ] !== 'POST ' ) {
132131 return ;
133132 } else if (strcmp ($ this ->removePhpUrl ($ _SERVER ['REQUEST_URI ' ]), $ parm )) {
134133 return ;
135134 }
136135
137136 http_response_code (201 );
138- $ this -> send ( $ function ($ this ->req ) );
137+ $ function ($ this ->req , $ this );
139138 }
140139
141140 public function put ($ parm , $ function )
142141 {
142+ $ parm = $ this ->convertParm ($ parm );
143143 if ($ _SERVER ['REQUEST_METHOD ' ] !== 'PUT ' ) {
144144 return ;
145145 } else if (strcmp ($ this ->removePhpUrl ($ _SERVER ['REQUEST_URI ' ]), $ parm )) {
146146 return ;
147147 }
148148
149- $ this -> send ( $ function ($ this ->req ) );
149+ $ function ($ this ->req , $ this );
150150 }
151151
152152 public function patch ($ parm , $ function )
153153 {
154+ $ parm = $ this ->convertParm ($ parm );
154155 if ($ _SERVER ['REQUEST_METHOD ' ] !== 'PATCH ' ) {
155156 return ;
156157 } else if (strcmp ($ this ->removePhpUrl ($ _SERVER ['REQUEST_URI ' ]), $ parm )) {
157158 return ;
158159 }
159160
160- $ this -> send ( $ function ($ this ->req ) );
161+ $ function ($ this ->req , $ this );
161162 }
162163
163164 public function delete ($ parm , $ function )
164165 {
166+ $ parm = $ this ->convertParm ($ parm );
165167 if ($ _SERVER ['REQUEST_METHOD ' ] !== 'DELETE ' ) {
166168 return ;
167169 } else if (strcmp ($ this ->removePhpUrl ($ _SERVER ['REQUEST_URI ' ]), $ parm )) {
168170 return ;
169171 }
170172
171- $ this -> send ( $ function ($ this ->req ) );
173+ $ function ($ this ->req , $ this );
172174 }
173175
174176 public function options ($ parm , $ function )
175177 {
178+ $ parm = $ this ->convertParm ($ parm );
176179 if ($ _SERVER ['REQUEST_METHOD ' ] !== 'OPTIONS ' ) {
177180 return ;
178181 } else if (strcmp ($ this ->removePhpUrl ($ _SERVER ['REQUEST_URI ' ]), $ parm )) {
179182 return ;
180183 }
181184
182- $ this -> send ( $ function ($ this ->req ) );
185+ $ function ($ this ->req , $ this );
183186 }
184187}
0 commit comments