Cannot parse feed - simplepie

I'm trying to parse this feed http://www.bbc.co.uk/sport/football/teams/newcastle-united/rss.xml
I get this message "A feed could not be found at http://. A feed with an invalid mime type may fall victim to this error, or SimplePie was unable to auto-discover it.. Use force_feed() if you are certain this URL is a real feed."
If I use force_feed I get an error "This XML document is invalid, likely due to invalid characters. XML error: Mismatched tag at line 27, column 8" but looking at the xml I can't see any errors. Indeed, checking at http://validator.w3.org/ seems to validate fine.
Any suggestions?
I'm running the latest version of simplepie downloaded a few days ago.

I found the problem when I stripped out the code to create a test case. The url being loaded was http://www.bbc.co.uk//sport/football/teams/newcastle-united/rss.xml (notice the double forward slash). simplepie seems to not be dealing with this gracefully. Removing the double slash fixes the problem

Related

How to escape out a backslash in API Request

I'm trying to hit the stock item WSE ("~entity/Default/20.200.001/StockItem/{keyvalue}") but when I have a InventoryCD with a slash in it (eg: "WD-ON/OFF") and I run it, I get the error Operation is not valid due to the current state of the object.
I tried using WebUtility.UrlEncode("WD-ON/OFF") to replace the / with %2f, but that doesn't seem to do anything. Per a long shot on the Aug forums, also tried to use "//" but that also does nothing.
The exact same code with a non-slash item works just fine.
Thoughts?
You should HTML encode your string
string myEncodedString = HttpUtility.HtmlEncode(filename);
It turns out that I'm not doing anything wrong. Acumatica support has sent this to Engineering, and there will be some future fix. For now, "don't do that" is their answer.

HealthCheckUI (AspNetCore.Diagnostics.HealthChecks) Unexpected Character 'H' error

I'm having an issue with the AspNetCore HealthCheckUI.
I followed this example:
https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks#healthcheckui
My UI is up and running and my services are up and running with a healthcheck that just returns a string "Healthy". And I think that's the root cause of the issue.
It looks like the UI is showing a "false" error because it's expecting JSON and seeing a string. And so it's throwing an "Unexpected character 'H'" error while parsing the response.
Is there a way to stop the healthcheckui from expecting json?
Is there a way have this AspNetCore HealthChecksUI package work with a Healthcheck that doesn't return JSON?
Found the closest thing I could find to an answer, which is basically change all my healthchecks to json :(
https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/issues/440

Getting illegal character when sending GET request in JMETER. Working fine in browser

Im getting illegal character in JMETER for GET request -
https://dev1/api/v1/query/job/?filter={%22job_manager_id%22:%22553f2350-12d3-4252-8fe0-39691019c495%22}
tried replacing %22 with "" but still getting illegal character.
Any solutions ?
I think problematic characters are { and }, they need to be percent-encoded
The options are in:
Tick "URL-encode" box next to the filter parameter in the HTTP Request sampler :
Use __urlencode() function in "Path" field like
see Apache JMeter Functions - An Introduction article to learn more about JMeter Functions concept
Or just hard-code the percent-encoded Path part like:
https://dev1/api/v1/query/job/?filter=%7B%22job_manager_id%22%3A%22553f2350-12d3-4252-8fe0-39691019c495%22%7D

Karate : How to send query param without url encoding

I'm currently writing Automated REST API tests using Karate dsl and I'm encountering an issue when I try a kind of destructive test. Sending invalid query parameter.
I follow the recommendation from this post Karate: Query Param values are getting encoded who is to use the url only but it seems to not work with query parameter:
Scenario: Destructive testing - Illegal characters in parameters or payload
* def buildURL = 'http://127.0.0.1/identity/client?query={"idClient":{"$eq":9223372036854775807}}'
Given url buildURL
When method GET
Then status 400
error:
java.net.URISyntaxException: Illegal character in query at index 39: http://127.0.0.1/identity/client?query={"idClient":{"$eq":9223372036854775807}}
I have the same kind of test for url path where it works fine, but for query param, this way does not seems to work.
To be clear, my goal is to send query params or at least the character { without url encoding
Any idea to solve that ?
Thanks in advance
karate version : 0.9.6
First, you are trying illegal characters as per the spec, so you may need to manually "URL-encode" the URL - and you already seem to be aware of all this, based on the link in your question. Maybe your server is not compliant with the spec.
Recommend you try upgrading to 1.0 and also refer this open issue: https://github.com/intuit/karate/issues/1561
Anything beyond this will require you to help / contribute code.

How to properly encode special characters in a REST API url

EDIT: The NHTSA docs, as CBroe points out, say to replace an ampersand with an underscore. However, I'm also getting an error with forward slashes (albeit a different one, page not found, because it's decoding the slash), for example the make 'EXISS/SOONER':
http://www.nhtsa.gov/webapi/api/Recalls/vehicle/modelyear/1997/make/EXISS%2FSOONER?format=json
And replacing the ampersand with an underscore no longer results in an error message, but in zero results returned, which should not be the case.
ORIGINAL POST:
I'm trying to download the content from the following URL:
http://www.nhtsa.gov/webapi/api/Recalls/vehicle/modelyear/1997/make/s&s?format=json
And the site returns the following error message:
Server Error in '/' Application.
A potentially dangerous Request.Path value was detected from the client (&).
The problem is the ampersand; a similar request for a different car make works:
http://www.nhtsa.gov/webapi/api/Recalls/vehicle/modelyear/1997/make/toyota?format=json
I have verified from a different endpoint that S&S is a valid make for the API.
Based on stackoverflow answers, I've tried all the following without success:
http://www.nhtsa.gov/webapi/api/Recalls/vehicle/modelyear/1997/make/s%26s?format=json
http://www.nhtsa.gov/webapi/api/Recalls/vehicle/modelyear/1997/make/s%26amp;s?format=json
http://www.nhtsa.gov/webapi/api/Recalls/vehicle/modelyear/1997/make/s%26amp%3Bs?format=json