Skip to content

Split sendRequest method on 2 or more methods #42

@dimitrystd

Description

@dimitrystd

SmartlingFileApi.sendRequest contains too many conditions. Splitting of this method was discussed couple times in reviews 162 and 163. Probably we could leave it as is, but i see code becames more complex after each commit 81de044. No one even thinks how to test this method. We put too many responsibilities on the single method:

  • Decide how to prepare query according to http method (GET\POST\DELETE)
  • Validate parameters
  • Make a decision what is inside API response (file body or JSON with stats)
  • Decide how to parse API response
  • Error handling

We have fixed number API calls. We always know input parameters and what will be returned. We must group API calls and use appropriate implementation of sendRequest for each group.

DoD: SmartlingFileApi.sendRequest is rewritten by couple methods without over responsibility and low cyclomatic complexity

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions