如何组合2个不同的responseEntity并返回
Alamofire.request(
apiURL,
parameters: ["UserID": post.userID]
)
.responseData { response in
guard response.result.isSuccess else {
print("Error while fetching Data: \(String(describing: response.result.error))")
return
}
if let headers = response.response?.allHeaderFields as? [String: String]{
if let myHeader = headers["profileImageURL"] as? String {
print(myHeader)
}
答案 0 :(得分:0)
您可以为响应制作DTO课程:
public class ResponseDto {
private Shop shop;
private Delear delear;
// getters and setters
}
然后
ResponseDto response = new ResponseDto();
response.setShop(shop);
response.setDelear(delear);
然后制作你的方法public ResponseEntity<ResponseDto> getObject
......
和return new ResponseEntity<>(response, HttpStatus.OK);