Files
Pulse/Sources/PulseUI/Extensions/PulseCore+Extensions.swift
2022-08-13 17:00:49 -04:00

29 lines
768 B
Swift
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// The MIT License (MIT)
//
// Copyright (c) 20202022 Alexander Grebenyuk (github.com/kean).
import Foundation
import Pulse
extension NetworkTaskEntity {
var requestFileViewerContext: FileViewerViewModel.Context {
FileViewerViewModel.Context(
contentType: originalRequest?.contentType,
originalSize: requestBodySize,
metadata: metadata,
isResponse: false,
error: nil
)
}
var responseFileViewerContext: FileViewerViewModel.Context {
FileViewerViewModel.Context(
contentType: response?.contentType,
originalSize: responseBodySize,
metadata: metadata,
isResponse: true,
error: decodingError
)
}
}