You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying add a content transformer to the parsing phase of the Siesta pipeline using the following:
self.service.configure("**") { [weak self] in // all endpoints
guard let strongSelf = self else {
return
}
$0.pipeline[.parsing].add(TextResponseTransformer(), contentTypes: ["*/xml"])
/* other configuration code */
}
However, when a network response with the content type application/xml; charset=utf-8 comes in, the content type is not matching to the regex that Siesta has generated in the add call. I have written the following playground code, which I believe replicates what Siesta is doing when it looks for a matching content type:
import UIKit
var str = "application/xml; charset=utf-8"
let regex = try! NSRegularExpression(pattern: "^[^/+]+\\/xml($|;)")
print(regex.description)
let fullRange = NSRange(location: 0, length: (str as NSString).length)
let match = regex.firstMatch(in: str, options: [], range: fullRange)
As far as I can tell, this should replicate what Siesta does in the file Regex+Siesta.swiftin its extension NSRegularExpression.matches(). However, the above playground code gets a match while Siesta does not. If I change the pipeline transformer add to:
I am trying add a content transformer to the parsing phase of the Siesta pipeline using the following:
However, when a network response with the content type
application/xml; charset=utf-8
comes in, the content type is not matching to the regex that Siesta has generated in theadd
call. I have written the following playground code, which I believe replicates what Siesta is doing when it looks for a matching content type:As far as I can tell, this should replicate what Siesta does in the file
Regex+Siesta.swift
in its extensionNSRegularExpression.matches()
. However, the above playground code gets a match while Siesta does not. If I change the pipeline transformer add to:It works as expected. Why won't the pattern
*/xml
work? It seems like it should.Thanks for the help with this!
The text was updated successfully, but these errors were encountered: