Skip to content
This repository was archived by the owner on May 29, 2024. It is now read-only.
This repository was archived by the owner on May 29, 2024. It is now read-only.

Array Indices #3

Closed
Closed
@battis

Description

@battis

It looks like Canvas is expecting URL parameters for arrays that do not include numerical indices. For example, Canvas would expect this:

http://canvas-instance.instructure.com/api/v1/courses/123/sections?include[]=students&include[]=enrollments

At the same time http_build_query() 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://canvas-instance.instructure.com/api/v1/courses/123/sections?include%5B%5D=students&include%5B%5D=enrollments

Moreover, it appears that Pest calls Pest::prepData() for Pest::put() and Pest::post() only, essentially as a check to see if a file upload is included as part of the data parameters, but reconfiguring Pest::get() would require essentially overriding the entire method, as it embeds the http_build_query() call in the method, without calling Pest::prepData().

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions