Commit 0fe1348
Allow http_build_query() override
This seems like the kind of thing that one should never want to do. Unless... you're dealing with a RESTful API that doesn't seem to understand URL parameters that contain numeric indices for the base array. [For example](smtech/canvaspest#3):
Instructure Canvas is expecting URL parameters for arrays that do not include numerical indices:
```
http://canvas-instance.instructure.com/api/v1/courses/123/sections?include[]=students&include[]=enrollments
```
At the same time [`http_build_query()`](https://github.com/smtech/canvaspest/blob/9110d69f756ff49e8da687381eaee52a767c0389/CanvasPest.php#L108) is trying to build legal URL parameters, which require that at least the base URL be indexed, resulting in shenanigans like this:
```
http://canvas-instance.instructure.com/api/v1/courses/123/sections?include%5B0%5D=students&include%5B1%5D=enrollments
```
It appears, at least, that Canvas tolerates URL-encoded arrays, but not the indices, so a request like this would work, allowing the result of `http_build_query()` to be post-processed [as described here](http://php.net/manual/en/function.http-build-query.php#111819):
```
http://canvas-instance.instructure.com/api/v1/courses/123/sections?include%5B%5D=students&include%5B%5D=enrollments
```1 parent fcb539e commit 0fe1348
1 file changed
Lines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
130 | 139 | | |
131 | 140 | | |
132 | 141 | | |
| |||
143 | 152 | | |
144 | 153 | | |
145 | 154 | | |
146 | | - | |
| 155 | + | |
147 | 156 | | |
148 | 157 | | |
149 | 158 | | |
| |||
410 | 419 | | |
411 | 420 | | |
412 | 421 | | |
413 | | - | |
| 422 | + | |
414 | 423 | | |
415 | 424 | | |
416 | 425 | | |
| |||
452 | 461 | | |
453 | 462 | | |
454 | 463 | | |
455 | | - | |
| 464 | + | |
456 | 465 | | |
457 | 466 | | |
458 | 467 | | |
| |||
0 commit comments