Update cliRequestOptions interface
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.5k
- Forks
- 413
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 21
Description
While using the command spo page publish, I referenced the wrong file and noticed that we were throwing the entire JSON error on failure.
This is because the request we're firing has no returnType property.
This is something that happens occasionally, and we maintainers sometimes overlook things like this. Therefore I suggest that we implement a more durable solution. I can't think of a request right away that doesn't have a responseType. Let's update our request interface and make responseType a required parameter.
Besides responseType, I think we can also make url and headers required. If I'm not mistaken, in CLI, every request needs at least one header, else the access token is not added to the request. I know we have some anonymous commands that don't need an access token, let's check if they all can have a header.
TL;DR
Make following options required in the cliRequestOptions interface:
-
responseType -
url -
headers
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/request.ts to inspect cliRequestOptions, then read the request in src/m365/spo/commands/page/page-publish.ts that exposes the missing responseType. Search all request call sites and check anonymous commands for suitable headers. Done means every call satisfies required responseType, url, and headers without breaking anonymous requests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100