Refactor REST makeCall logic - #14
Conversation
…estRequests/RestApiCaller.swift:230-338). Pulling out helpers for query assembly, MIME
validation, and error handling will make the success/error branches clearer and open the door to unit tests for each step.
PR Compliance Guide 🔍(Compliance updated until commit 511aa16)Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label Previous compliance checksCompliance check up to commit 511aa16
|
||||||||||||||||||||||||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
User description
Refactored makeCall into smaller helpers so MIME validation, success decoding, and error construction each live in focused private methods. The main flow now early-exits for bodyless responses, validates the content type, decodes success payloads, or builds structured errors.
PR Type
Enhancement
Description
Refactored
makeCallinto focused private helper methodsExtracted
shouldBypassDeserializationfor early-exit logicExtracted
validatedMimeTypefor MIME type validationExtracted
decodeSuccessfulResponsefor success payload deserializationExtracted
buildErrorResponsefor structured error constructionImproved code readability and testability with clearer separation of concerns
Diagram Walkthrough
File Walkthrough
RestApiCaller.swift
Extract makeCall logic into focused helper methodsSources/SwiftRestRequests/RestApiCaller.swift
makeCallmethod by extracting four private helper methodsshouldBypassDeserializationchecks if deserialization should beskipped
validatedMimeTypevalidates and returns the MIME type from responseheaders
decodeSuccessfulResponsehandles successful response deserializationwith error handling
buildErrorResponseconstructs structured error responses from errordata
branching