截至今天(2017年9月13日),Bing圖片搜索v 5.0是否更改其後端API?Bing圖片搜索v5.0返回錯誤
使用this console,將值爲「multipart/form-data」的頭文件「Content-Type」添加到給出的響應中的期望值。
然而,從我的具有完全相同的參數和頭iOS應用調用時,收到的錯誤響應「RequestParameterInvalidValue; 消息=‘參數具有無效值。’; 參數= imgUrl的;」
下面的代碼工作,截至昨日:
NSString* path = @"https://api.cognitive.microsoft.com/bing/v5.0/images/search";
NSString* skip = [NSString stringWithFormat:@"skip=%li", (long)searchOffset];
NSString* queryString = [NSString stringWithFormat:@"q=%@", searchQuery];
NSArray* array = @[
// Request parameters
@"entities=true",
@"count=50",
skip,
@"safeSearch=Strict",
queryString
];
NSString* string = [array componentsJoinedByString:@"&"];
path = [path stringByAppendingFormat:@"?%@", string];
NSLog(@"%@", path);
NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
[_request setHTTPMethod:@"POST"];
// Request headers
[_request setValue:@"multipart/form-data" forHTTPHeaderField:@"Content-Type"];
[_request setValue:accessKey forHTTPHeaderField:@"Ocp-Apim-Subscription-Key"];
// Request body
[_request setHTTPBody:[path dataUsingEncoding:NSUTF8StringEncoding]];
我可以刪除在測試代碼中的Content-Type頭,並獲得工作的響應,但昨天這個工作我們的生產應用。有沒有解決方法讓我的生產代碼再次運行,而無需重新提交應用程序進行審批?
我昨天實際上經歷過同樣的行爲!我的測試通過了,突然間這個開始失敗,出現了完全相同的錯誤... –
似乎內容類型標題現已被棄用。 –