Chrome Mv3 How to Inspect HTTPS headers with declarativeNetRequest - chrome-extension-manifest-v3

I am trying to explore on inspecting request headers using declarativeNetRequest in chrome MV3, is there any sample or documentation to achieve this.(we need to just inspect the headers for logging purpose not block or modify etc).

Related

Post request always returning error in JMeter

I'm creating a load test with JMeter. I'm trying to make a Post request to create a new resource but it always responds with 500 error, even though I'm sending the same headers and parameters as the browser and I also tried with postman and it works fine, it's just with JMeter that's not working.
The script was recorded with the BlazeMeter Chrome extension and adjusted as needed.
The next configurations are for the Test Plan in general:
HTTP Header Manager with the header "User-Agent".
User Defined Variables with only one variable "BASE_URL_1".
HTTP Request Defaults with the "Retrieve All Embedded Resources" and "Parallel downloads" selected and "Number" set to 6.
DNS Cache Manager with "Clear cache each iteration" selected and "Use system DNS resolver".
HTTP Authorization Manager with nothing selected.
HTTP Cookie Manager with "Clear cookies each iteration?" selected.
HTTP Cache Manager with "Clear cache each iteration?" selected and "Max Number of elements in cache" set to 5000.
I set the "CookieManager.save.cookies" option to "true" in "jmeter.properties".
Here's an image of what the "HTTP Request" looks like:
Inside the "HTTP Request" there's a "HTTP Header Manager" with the next headers:
Inside the "HTTP Request" there's also a "Uniform Random Timer" with "Random Delay Maximum" set to 26344.0 and "Constant Delay Offset" set to 13172.
The cookies seemed to be sent fine with the session data. I do log in a user and get the session data before attempting to do the post request and other get requests work fine under the same session. I teste this same headers with Postman and it worked. I have no idea why this is not working in JMeter. I tried doing several changes to the configuration without success. This is a .NET service.
The API is not built the best way, but what makes me think that this 500 error might be from JMeter and not the API is that I was able to successfully make the request from postman.
Anyone has an idea of what could be wrong on the test config?
EDIT
Here are some images from the View Results Tree:
Sampler Result
Request Body
Request Headers
Response Headers
The Response Body is HTML saying that there's an error.
Given your request works in Postman you should be able to record it using JMeter's HTTP(S) Test Script Recorder.
Prepare JMeter for recording, the fastest and the easiest way is using JMeter Templates feature
From JMeter's main menu choose File -> Template -> Recording and click "Create"
Open HTTP(S) Test Script Recorder and click "Start"
Prepare Postman for recording.
From Postman main menu choose File -> Settings -> Proxy
Use 127.0.0.1 as the proxy host and 8888 as the proxy port
Run your request in Postman
JMeter will capture the request under the Recording Controller
Parameterize and correlate the request
It should be working fine. If not - compare the requests which are being sent by Postman and JMeter using a 3rd-party sniffer tool like Wireshark of Fiddler, detect and eliminate any inconsistencies.

Swagger UI - "Try it Out!" button call failing

I have installed Swagger UI on my local machine. When I am pulling up some Swagger definitions, the definitions are working fine, however, when I click on the "Try it out!" button, the call fails stating "No response from server".
However, when I take the Request URL from Swagger UI and run it directly in the browser, the server responds (BAU).
Am I missing something? Do I need to setup/configure Swagger UI to make this call happen?
Note: I have just downloaded the latest version of Swagger and running it locally on Windows desktop with Tomcat server.
Please help.
The specs for Swagger-ui is usually in JSON format which contains host(including port), basePath, paths (path array of each API service). Swagger-client will construct the request URL from all these properties and send the request to the URL with an "Accept" header. Now you can not get response from service you need to check whether the backend services are running. You can open browser development tools to capture the HTTP request and see if it is correct.
You can go to http://petstore.swagger.io/ to see how it works.

How to configure Neo4j Browser to use a custom REST endpoint?

The server is running a custom REST endpoint configured using the following line
org.neo4j.server.webadmin.data.uri=/db/abc
in neo4j-server.properties. REST is then working fine using /db/abc, but then the browser client (http://$SERVERHOST:7474/browser) stops working and displays the Disconnected from Neo4j message. Packet sniffing indicates it is still trying to connect to db/data. Clearing local web caches doesn't help. Is there a way to point the browser client to use a custom endpoint?
Sources indicate that /db/data is possibly hardcoded into the browser as part of client "Settings" (see line 23). There is supposedly a way to reconfigure these settings using the :config command in the client, but the command bar is only available when the client is already connected to the server.
Is there a way to get this to work, or is it possibly a bug in the browser client?
Current option is to download source code of the browser and change what you need.
https://github.com/neo4j/neo4j/tree/2.3/community/browser

How to debug client side dart code in Dart editor without CORS

I have a server / client project, both written in dart. Now my server starts on port 1337 and when I run my client with the Run in dartium, my static files are served on port 3030 which allows me to debug my client code in the Dart editor.
The problem is that this causes CORS when using AJAX calls. I have properly setup my server to accept other origins (with Access-Control-Allow-Origin) but, for example, cookies aren't sent along.
Now I'm wondering: is there a way to serve my files with my server (running on 1337) and still have the possibility to debug the client side code in the dart editor?
My understanding is that you can debug, but the real problem is that you don't get the expected data back from the server due to missing cookies.
Standard CORS requests do not send or set any cookies by default.
In order to include cookies as a part of the request, besides setting up the server, you need to specify withCredentials property, e.g.:
HttpRequest.getString(url, withCredentials:true)...
You will also need to setup server to provide Access-Control-Allow-Credentials header.
EDIT: it seems that additional issue is that you don't want to have 2 servers, each serving different part of app.
In that case, you can configure DartEditor to launch the URL, instead of files. Go to Run > Manage Launches and add create a new Dartium or Dart2JS launch with specified URL and source directory.
Another option is to select Run > Remote Connection and attach to a running instance of browser or Dart VM.
Caveat: I haven't tried these options, so I can't tell how stable they are.

Impossible to cross site ajax api calls in a chrome extension?

I am trying to create a chrome extension that calls my rails app's api. currently the api returns json and it works fine, however when I try to build it into a chrome extension, it says :
Refused to load script from 'http://mysite.com/demo?q=hello?callback=jQuery16409466155741829425_1342489669670&_=1342489677171' because of Content-Security-Policy.
I looked up the document http://code.google.com/chrome/extensions/contentSecurityPolicy.html and it sounds like I can't do this unless I implement my site into a https version. (under "Relaxing the default policy" section) I am not sure if I understood correctly and it feels ridiculous to make such a big change just because of this. Am I misunderstood? Or is there a workaround to this? Thank you.
In a Chrome extension, cross-site XMLHttpRequests are allowed, provided that you define the source in the manifest file - see http://code.google.com/chrome/extensions/xhr.html.
A JSONP implementation loads an external script using the <script> tag, and inserts it in the document. Unless the source is whitelisted through the "content_security_policy" entry, JSONP cannot be used when manifest version 2 is active (do not use manifest v1 to overcome this, because it's deprecated, and a suitable alternative already exist).
When you're unable to receive a JSON response instead of JSONP, use an ordinary request to fetch the data, cut off the callback, then parse it. Eg:
// response is the response from the server
// Received through `XMLHttpRequest`, jQuery.ajax, or whatever you used
// cuts of jQuery....( and the trailing )
response = response.replace(/^[^(]*\(/, '').replace(/\);?$/, '');
By default browsers do not allow this because of the same origin policy.
However you can get around this by making a jsonp request.
As you using jquery this super easy with getJSON method

Resources